From 961bca37e39bf5186e294984861ced49dc012f5b Mon Sep 17 00:00:00 2001 From: suyeun84 <81475092+suyeun84@users.noreply.github.com> Date: Tue, 2 Sep 2025 23:30:30 +0900 Subject: [PATCH] =?UTF-8?q?[20250902]=20PGM=20/=20LV3=20/=20=EC=A7=95?= =?UTF-8?q?=EA=B2=80=EB=8B=A4=EB=A6=AC=20=EA=B1=B4=EB=84=88=EA=B8=B0=20/?= =?UTF-8?q?=20=EA=B9=80=EC=88=98=EC=97=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 \352\261\264\353\204\210\352\270\260.md" | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 "suyeun84/202509/02 PGM LV3 \354\247\225\352\262\200\353\213\244\353\246\254 \352\261\264\353\204\210\352\270\260.md" diff --git "a/suyeun84/202509/02 PGM LV3 \354\247\225\352\262\200\353\213\244\353\246\254 \352\261\264\353\204\210\352\270\260.md" "b/suyeun84/202509/02 PGM LV3 \354\247\225\352\262\200\353\213\244\353\246\254 \352\261\264\353\204\210\352\270\260.md" new file mode 100644 index 00000000..10f4a27c --- /dev/null +++ "b/suyeun84/202509/02 PGM LV3 \354\247\225\352\262\200\353\213\244\353\246\254 \352\261\264\353\204\210\352\270\260.md" @@ -0,0 +1,32 @@ +```java +import java.util.*; +class Solution { + public int solution(int[] stones, int k) { + int answer = Integer.MIN_VALUE; + int start = 0; + int end = 200000000; + while (start <= end) { + int mid = (start + end) / 2; + int cnt = 0; + boolean flag = true; + for (int i = 0; i < stones.length; i++) { + if (stones[i] - mid < 0) { + cnt++; + } else { + cnt = 0; + } + if (cnt >= k) { + end = mid - 1; + flag = false; + break; + } + } + if (flag == true) { + answer = start; + start = mid + 1; + } + } + return end; + } +} +```