import java.util.Arrays;
// 구명보트 - 탐욕법(Greedy)
public class Lifeboat {
public int solution(int[] people, int limit) {
int answer = 0, j = 0;
Arrays.sort(people);
for (int i = people.length - 1; i >= 0; i--) {
answer++;
if (people[i] + people[j] <= limit) {
j++;
}
if (i <= j) {
break;
}
}
return answer;
}
}