Boats to Save People
Medium
Greedy (Advanced)
Each boat carries at most two people and a maximum weight limit. Print the minimum number of boats needed to carry everyone.
Constraints
1 <= n <= 5 * 10^4 1 <= weight <= limit <= 3 * 10^4
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.