Dsa
Binary Search
Medium
Package Distribution
A delivery service needs to distribute a set number of packages among different routes while ensuring that no single route exceeds its maximum capacity. Given an array representing the capacities of each route and an integer representing the total number of packages to distribute, find the minimum capacity that must be set for any single route such that all packages can be delivered. The input consists of the first line containing space-separated integers (capacities) and the second line containing the total number of packages. Example:
Input:
10 20 30 40
50
Output:
30
Key concepts
binary_searchgreedyarray
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