crates[i] = [count, per_crate] means there are count crates of this kind and each holds per_crate items.
The van fits at most capacity crates of any mix of kinds. Crates are never opened: each one is taken whole or left behind.
Return the largest number of items the courier can carry in one trip.crates=[[3, 2], [1, 7], [4, 5]], capacity=5 → 27
Take the crate with 7 items and all four crates with 5: 7 + 4 · 5 = 27.
crates=[[2, 4], [2, 3]], capacity=10 → 14
There is more room than crates, so everything goes in: 2 · 4 + 2 · 3 = 14.
crates=[[5, 1], [1, 9], [2, 6]], capacity=2 → 15
crates=[[3, 2], [1, 7], [4, 5]], capacity=5
27
Run checks the first 3 tests in your browser. Submit checks all 105 tests on the server, hidden ones included.