Amazon operates multiple fulfillment centers. Each center follows a special packaging rule.
You are given: An integer list packEffort of size m where packEffort[i] is the packaging effort required for the i-th item.
An integer list packageCount of size n where packageCount[i] indicates that at the i-th fulfillment center, if you pay to package at least packageCount[i] items, you get 2 extra items for free. The 2 bonus (free) items must each have a packaging effort less than or equal to the smallest effort among the paid items at that center.
You can use any fulfillment center once or not at all.
Goal:
Return the minimum total packaging effort required to package all m items using any number of fulfillment centers.
Constraints:
1 ≤ n ≤ 10^51 ≤ m ≤ 10^50 ≤ packEffort[i] ≤ 10^4Each item must be packaged exactly once
A super huge thank you to an incredible friend who so generously shared the valuable source! 🐳
packEffort = [50, 50, 30, 50, 20] packageCount = [2, 3] return = 120
🥝- 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 minTotalPackagingEffort(List<Integer> packEffort, List<Integer> packageCount) {
// write your code here
}