Fewest two-seat boats
weights[i] is the weight of person i. Every boat carries at most two people, and their total weight must not exceed limit. Nobody weighs more than limit, and there are as many boats as you need. Return the fewest boats that carry everyone.
weights may be empty and may repeat values. Sorting is fine; after it, aim for one O(n) pass instead of searching for each person's partner.
Besides the tests, one large input (3,800 people) with a ~100 ms limit (scaled to your device's speed): brute force won't pass.
Examples
fewest_boats([70,50,80,50], 100)→3fewest_boats([1,2,8,9], 10)→2fewest_boats([1,1,1,1], 5)→2