Question bank › Two Pointers
Dsa Two Pointers Easy

Efficient Freight Pairing

You are loading items onto freight boats. Each boat has a maximum weight capacity C and can carry at most two items at a time. Given a list of item weights, find the minimum number of boats required to transport all items. Input Format: Line 1: An integer C representing the capacity of one boat. Line 2: A space-separated list of item weights. (The list is not necessarily sorted). Output Format: A single integer representing the minimum number of boats. Example: Input: 10 3 2 2 1 Output: 2 (Explanation: Boat 1: [3, 1], Boat 2: [2, 2].)

Key concepts

two_pointersgreedy

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.