shops shops. The warehouse holds several kinds of goods: stock[i] is the number of units of kind i. All of it must be delivered to the shops under these rules:
- each shop receives goods of at most one kind, in any amount;
- a shop may receive nothing.
Let x be the largest number of units any single shop receives. Return the smallest possible x.shops=5, stock=[7, 4] → 3
Split the 7 units of the first kind across three shops (3, 2, 2) and the 4 units of the second across two (2, 2). The busiest shop holds 3.
shops=3, stock=[1, 9, 2] → 9
Each kind needs at least one shop, so all 9 units of the second kind end up in a single shop.
shops=4, stock=[10] → 3
shops=5, stock=[7, 4]
3
Run checks the first 3 tests in your browser. Submit checks all 101 tests on the server, hidden ones included.