Minimum kayaks needed

Write codeEasy12 min

Your task

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.

Examples

min_kayaks(weights: list[int], limit: int) -> int
Example 1
Inputmin_kayaks([70, 50, 80, 50], 120)
Output3