Question bank › Greedy
Dsa Greedy Medium

Parcel Delivery Optimization

You are running a delivery service that needs to optimize the number of parcels delivered based on their sizes and the capacity each vehicle can carry. Your goal is to maximize the number of parcels delivered without exceeding vehicle capacity. Input: The first line contains two integers: `C` (capacity of each vehicle) and `N` (number of parcels). The next `N` lines each contain an integer: `S_i` (size of the parcel). Output: Print a single integer: the total number of parcels successfully delivered. Example: Input: 10 5 2 3 4 5 1 Output: 4

Key concepts

greedypriority queuesorting

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 Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.