Problem
box_types[i] = [count, units] means there are count boxes of type i, and each holds units units. The truck carries at most truck_size boxes, of any types. Return the maximum total units you can load.
Example 1
- Input
- box_types = [[1, 3], [2, 2], [3, 1]], truck_size = 4
- Output
- 8
- Why
- 3 + 2 + 2 + 1
Example 2
- Input
- box_types = [[5, 10], [2, 5], [4, 7], [3, 9]], truck_size = 10
- Output
- 91
Constraints
1 <= box_types.length <= 10001 <= count, units <= 10001 <= truck_size <= 10^6