public int solution(int[] people, int limit) {
Arrays.sort(people);
int answer = 0;
int min = 0;
int max = people.length - 1;
while (min <= max) {
if (people[min] + people[max] <= limit) {
min++;
}
max--;
answer++;
}
return answer;
}
출처:https://school.programmers.co.kr/learn/courses/30/lessons/42885