Code RoomMinimum kayaks needed
EasyPrep Room Coding #636

Minimum kayaks needed

CodingAlgorithms & data structuresEntry–Mid~12 min

A lakeside rental shop seats at most two people per kayak, and each kayak can carry at most limit kilograms in total. weights lists each customer's weight, and no single customer exceeds the limit. Return the minimum number of kayaks needed to get everyone on the water at once. Example: weights [70, 50, 80, 50] with limit 120 needs 3 kayaks.

Implement
min_kayaks(weights: list[int], limit: int) → int
Examples
in[[70,50,80,50],120]out3
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 12 min
InputExpectedGot
[[70,50,80,50],120]3not run yetsample