From 7dd4a7fdb7d1d4978769f422f91033871f5186dd Mon Sep 17 00:00:00 2001 From: suyeun84 <81475092+suyeun84@users.noreply.github.com> Date: Sun, 12 Oct 2025 23:02:08 +0900 Subject: [PATCH] =?UTF-8?q?[20251012]=20PGM=20/=20LV2=20/=20=ED=98=B8?= =?UTF-8?q?=ED=85=94=20=EB=8C=80=EC=8B=A4=20/=20=EA=B9=80=EC=88=98?= =?UTF-8?q?=EC=97=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0\355\205\224 \353\214\200\354\213\244.md" | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 "suyeun84/202510/12 PGM LV2 \355\230\270\355\205\224 \353\214\200\354\213\244.md" diff --git "a/suyeun84/202510/12 PGM LV2 \355\230\270\355\205\224 \353\214\200\354\213\244.md" "b/suyeun84/202510/12 PGM LV2 \355\230\270\355\205\224 \353\214\200\354\213\244.md" new file mode 100644 index 00000000..aacbbb72 --- /dev/null +++ "b/suyeun84/202510/12 PGM LV2 \355\230\270\355\205\224 \353\214\200\354\213\244.md" @@ -0,0 +1,33 @@ +```java +import java.util.*; +class Solution { + static int toInt(String s) {return Integer.parseInt(s);} + + public int solution(String[][] book_time) { + int answer = 0; + int len = book_time.length; + if (len == 1) return 1; + Arrays.sort(book_time, (a, b) -> a[0].compareTo(b[0])); + + PriorityQueue q = new PriorityQueue<>(); + String[] e = book_time[0][1].split(":"); + q.add(toInt(e[0])*60 + toInt(e[1])); + + int idx = 1; + while (!q.isEmpty()) { + int curr = q.peek(); + String[] start = book_time[idx][0].split(":"); + String[] end = book_time[idx][1].split(":"); + + int sMin = toInt(start[0])*60 + toInt(start[1]); + int eMin = toInt(end[0])*60 + toInt(end[1]); + if (curr + 10 <= sMin) q.poll(); + q.add(eMin); + idx++; + if (idx >= len) break; + } + + return q.size(); + } +} +```