Maximum items in van

Write codeMedium13 minAmazon style

Your task

A parcel van has room for at most capacity boxes. boxes[i] = [count, units] says the depot holds count identical boxes of type i, each containing units items. You may load any whole boxes you like, mixing types, as long as the number of boxes loaded stays within capacity. Return the maximum total number of items the van can carry. Example: boxes [[1,3],[2,2],[3,1]] with capacity 4 carries 8 items.

Examples

max_loaded_items(boxes: list[list[int]], capacity: int) -> int
Example 1
Inputmax_loaded_items([[1, 3], [2, 2], [3, 1]], 4)
Output8