Find the Output

Question to Solve

Given an array. The ith person has weight people[i], and each boat carry a maximum weight of LIMIT.

Each boat carries atmost 2 people at the same time, and the sum of the weight of the those people is atmost LIMIT.

Return the minimum number of boats to carry every given person.


Sample Input

Sample Output