Question bank › Greedy
Dsa Greedy Easy

Expedition Rafts

An expedition team of N people needs to cross a river. Each person i has a weight W[i]. You have several identical rafts, each with a maximum weight capacity C. Each raft can carry at most TWO people at a time, provided their combined weight is <= C. What is the minimum number of rafts needed to transport everyone? Input Format: The first line contains N and C. The second line contains N integers representing W[i]. Output Format: A single integer representing the minimum number of rafts. Example: Input: 4 10 3 5 8 7 Output: 3 Explanation: Raft 1: (3, 7), Raft 2: (8), Raft 3: (5).

Key concepts

greedytwo-pointerssorting

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.