We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0af3699 + 961bca3 commit 2cc33f7Copy full SHA for 2cc33f7
suyeun84/202509/02 PGM LV3 징검다리 건너기.md
@@ -0,0 +1,32 @@
1
+```java
2
+import java.util.*;
3
+class Solution {
4
+ public int solution(int[] stones, int k) {
5
+ int answer = Integer.MIN_VALUE;
6
+ int start = 0;
7
+ int end = 200000000;
8
+ while (start <= end) {
9
+ int mid = (start + end) / 2;
10
+ int cnt = 0;
11
+ boolean flag = true;
12
+ for (int i = 0; i < stones.length; i++) {
13
+ if (stones[i] - mid < 0) {
14
+ cnt++;
15
+ } else {
16
+ cnt = 0;
17
+ }
18
+ if (cnt >= k) {
19
+ end = mid - 1;
20
+ flag = false;
21
+ break;
22
23
24
+ if (flag == true) {
25
+ answer = start;
26
+ start = mid + 1;
27
28
29
+ return end;
30
31
+}
32
+```
0 commit comments