Problem Brief
Calculate Warehouse Efficiency (Probably for Supply Chain related NG positions --Fungible-- :)
NEW GRADOA
See Amazon online assessment and 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.
1Example 1
Input
parcelWeights = [4, 4, 8, 5, 3, 2]
Output
17
Explanation

2Example 2
Input
parcelWeights = [2,1,8,5,6,2,4]
Output
23
Explanation

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
Limits and guarantees your solution can rely on.
1<=n<=2x10^5
0<=parcle_weights[i]<=10^9