Question bank › Greedy
Dsa Greedy Warm-up

Parcel Sorting

You have several parcels of different weights, and you want to divide them into groups such that the weight of each group does not exceed a given maximum limit. Your task is to find the minimum number of groups needed to accommodate all parcels. Each group can hold parcels as long as their total weight does not exceed the limit. Input Format: - The first line contains an integer n, the number of parcels. - The second line contains n space-separated integers representing the weights of each parcel. - The third line contains an integer limit, the maximum weight limit per group. Output Format: - An integer representing the minimum number of groups required. Example: Input: 5 2 3 5 7 1 10 Output: 3

Key concepts

greedysortingarray

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.