AmazonOA #322
Package Delivery System
Estimated MediumStatement and editorial — judging is being prepared
Topics (AI-labelled)GreedyStacks & Heaps
Each shipment scenario has a list of truck capacities and a list of pa
Constraints
The number of scenarios and the lengths of the nested arrays can be large, so the solution should avoid brute-force backtracking over all assignments.
Example 1
Input:
truckCapacities = [[7]]
packageWeights = [[4, 3]]
Output:
[1]
Explanation:
The single truck delivers package 4, its capacity drops to 3, and it can still deliver package 3. The scenario is feasible.
Editorial
Loading solution…