Practice Maximum Units on a Truck
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
boxTypes[i] = [boxCount,unitsPerBox] describes available boxes of one type. Select no more than truckSize boxes total, choosing any quantities up to each available count. Return the greatest total number of units carried.
Source: Maximum Units on a Truck on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
boxTypes = [[1,3],[2,2],[3,1]], truckSize = 4
Output
8
# Example 2
Input
boxTypes = [[5,10],[2,5],[4,7],[3,9]], truckSize = 10
Output
91
Constraints
1 <= boxTypes.length <= 1000
1 <= numberOfBoxesi, numberOfUnitsPerBoxi <= 1000
1 <= truckSize <= 10^6
Related LeetCode Problems
Practice more problems similar to Maximum Units on a Truck.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.