We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ce4a003 + f0999b4 commit 19f78c5Copy full SHA for 19f78c5
1 file changed
lkhyun/202512/13 PGM Lv2 구명보트.md
@@ -0,0 +1,20 @@
1
+```java
2
+import java.util.*;
3
+class Solution {
4
+ public int solution(int[] people, int limit) {
5
+ int answer = 0;
6
+ Arrays.sort(people);
7
+ int left = 0;
8
+ int right = people.length-1;
9
+
10
+ while(left <= right){
11
+ int rest = limit - people[right--];
12
+ answer++;
13
+ if(rest >= people[left]){
14
+ left++;
15
+ }
16
17
+ return answer;
18
19
+}
20
+```
0 commit comments