Amazon Delivery Centers dispatch parcels every day. There are n delivery centers, each having parcels[i] parcels to be delivered.
On each day, an equal number of parcels are to be dispatched from each delivery center that has at least one parcel remaining.
Find the minimum number of days needed to deliver all the parcels.
Complete the function minDaysToDeliverParcels in the editor below.
minDaysToDeliverParcels has the following parameters: int parcels[n]: the number of parcels at each center
Returns
int: the minimum number of days needed to deliver all the parcels
Constraints
1 ≤ n ≤ 10^60 ≤ parcels[i] ≤ 10^9
Examples
01 · Example 1
parcels = [2, 3, 4, 3, 3] return = 3
All parcels can be delivered in a minimum of 3 days.
02 · Example 2
parcels = [3, 3, 3, 3, 3, 3] return = 1
Each delivery center can dispatch its 3 parcels on the first day.
Constraints
1 ≤ n ≤ 10^60 ≤ parcels[i] ≤ 10^9More Amazon problems
- Count Promotional PeriodsOA · Seen Jun 2026
- Find Maximum Total Amount (SDE I, Fungible :)Seen Jun 2026
- Get Minimum AmountOA · Seen Jun 2026
- Find Minimum CostOA · Seen Jun 2026
- Get Smallest Base SegmentOA · Seen Jun 2026
- Select Least Resource TasksOA · Seen Jun 2026
- Product Category Group SizesPHONE SCREEN · Seen May 2026
- Count Connected ComponentsPHONE SCREEN · Seen May 2026
public int minDaysToDeliverParcels(int[] parcels) {
// write your code here
}
parcels[2, 3, 4, 3, 3]
expected3
sign in to submit