Problem · Array
Calculate Warehouse Efficiency (Probably for Supply Chain related NG positions --Fungible-- :)
See Amazon hiring insights
The supply chain manager at one of Amazon's warehouses wants to measure the efficiency of the way parcels are shipped. The volume of each parcel is represented in the array parcelWeights. Each day, the first and last parcels in the array parcelWeights are shipped until all of them are dispatched.
The manager comes up with metrics to calculate warehouse efficiency. Each day before shipping, any parcel in the warehouse is chosen and its volume is added to the sum of total efficiency. A parcel can only be chosen once.
Given the array parcelWeights, find the maximum possible efficiency of the warehouse.
Examples
01 · Example 1
parcelWeights = [4, 4, 8, 5, 3, 2] return = 17

02 · Example 2
parcelWeights = [2,1,8,5,6,2,4] return = 23

In case 1, the order of picked parcels would produce an answer of 4 + 2 + 8 + 5 = 19, which is incorrect. The correct selection of parcels would be in scenario 2, where the answer will be 4 + 6 + 8 + 5 = 23.
🥹
Constraints
1<=n<=2x10^5
0<=parcle_weights[i]<=10^9
More 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 calculateWarehouseEfficiency(int[] parcelWeights) {
// write your code here
}
parcelWeights[4, 4, 8, 5, 3, 2]
expected17
sign in to submit