function solution(people, limit) {
let answer = 0;
let arr = [...people].sort((a,b) => b-a);
let [left, right] = [0, arr.length-1];
while (left < right) {
let sum = arr[left] + arr[right];
if (sum > limit) left++;
else {
left++;
right--;
}
answer++;
}
if (left === right) answer++;
return answer;
}