← 返回 amazon 的题目列表Minimize Operational Overhead in Logistics Network
类型:online_judge
In Amazon’s efficient logistics network, minimizing operational overhead and optimizing package routing is crucial to ensuring smooth deliveries across regions.
The network consists of warehouses numbered from 1 to n, each with a specific storage capacity, given in the warehouseCapacity array.
The capacity at position i (1-based index) is not less than the capacity at position j where j < i.
The goal is to maximize the number of packages that can be processed with the given capacities, following constraints for transferring between warehouses to achieve minimum possible operational overhead.
Input
n: integer representing the number of warehouses.
warehouseCapacity: integer array of length n, representing each warehouse's capacity.
Output
Return an integer representing the maximum number of packages processed.
Constraints
Warehouses must be chosen for packages in increasing order.
Example
Input:
n = 5
warehouseCapacity = [1, 2, 3, 4, 5]
Output:
5
Example
Input
5
1 2 3 4 5