From 11b2e63c23bce6c6ee8149a67cb7eae8c953ead6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EC=8B=A0=EC=A7=80?= <101992179+ksinji@users.noreply.github.com> Date: Wed, 22 Oct 2025 22:47:33 +0900 Subject: [PATCH] =?UTF-8?q?[20251022]=20PGM=20/=20LV2=20/=20=EC=9A=94?= =?UTF-8?q?=EA=B2=A9=20=EC=8B=9C=EC=8A=A4=ED=85=9C=20/=20=EA=B0=95?= =?UTF-8?q?=EC=8B=A0=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1 \354\213\234\354\212\244\355\205\234.md" | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 "ksinji/202510/22 PGM \354\232\224\352\262\251 \354\213\234\354\212\244\355\205\234.md" diff --git "a/ksinji/202510/22 PGM \354\232\224\352\262\251 \354\213\234\354\212\244\355\205\234.md" "b/ksinji/202510/22 PGM \354\232\224\352\262\251 \354\213\234\354\212\244\355\205\234.md" new file mode 100644 index 00000000..488b0e3d --- /dev/null +++ "b/ksinji/202510/22 PGM \354\232\224\352\262\251 \354\213\234\354\212\244\355\205\234.md" @@ -0,0 +1,21 @@ +```java +import java.util.*; + +class Solution { + public int solution(int[][] targets) { + Arrays.sort(targets, (a, b) -> Integer.compare(a[1], b[1])); + + int answer = 0; + int lastEnd = Integer.MIN_VALUE; + + for (int[] t : targets) { + int s = t[0], e = t[1]; + if (s >= lastEnd) { + answer++; + lastEnd = e; + } + } + return answer; + } +} +```