Skip to content

Commit 32a8453

Browse files
authored
Merge pull request #779 from AlgorithmWithGod/suyeun84
[20250830] PGM / LV3 / 입국심사 / 김수연
2 parents 6d0742b + 460a431 commit 32a8453

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
```java
2+
import java.util.*;
3+
class Solution {
4+
public long solution(int n, int[] times) {
5+
Arrays.sort(times);
6+
long start = 0;
7+
long end = (long)times[times.length-1]*(long)n;
8+
while (start <= end) {
9+
long mid = (start + end) / 2;
10+
long total = 0;
11+
for (int i = 0; i < times.length; i++) {
12+
total += mid / times[i];
13+
}
14+
if (total < n) {
15+
start = mid + 1;
16+
} else {
17+
end = mid - 1;
18+
}
19+
}
20+
return start;
21+
}
22+
}
23+
```

0 commit comments

Comments
 (0)