Richest Customer Wealth
Real-world version: Depot Holding the Most StockThe statement here is our own: the same inputs, outputs and technique.
A wholesaler runs several depots and carries the same set of product lines in each of them. stock[d][p] is the number of units of product line p sitting in depot d.
A depot's holding is the number of units it has across all of its product lines added together.
Return the largest holding of any single depot.
Examples
Example 1
- Input
- stock = [[7, 2, 9], [4, 4, 4], [1, 1, 20]]
- Output
- 22
Depot 0 holds 18 units, depot 1 holds 12 and depot 2 holds 22, so the largest holding is depot 2's.
Example 2
- Input
- stock = [[100, 1], [50, 49]]
- Output
- 101
Depot 0 holds 101 units and depot 1 holds 99.
Example 3
- Input
- stock = [[6, 4], [5, 5]]
- Output
- 10
Both depots hold ten units in total, so that figure is what comes back.
Constraints
- m == stock.length
- n == stock[d].length
- 1 <= m, n <= 50
- 1 <= stock[d][p] <= 100
The signature
The editor starts with this. It matches the parent problem's shape, so a solution that works here works on a standard judge unchanged.
def busiest_depot_total(stock: list[list[int]]) -> int:public int busiestDepotTotal(int[][] stock)Checking your plan…
How this problem was checked
- Passed: Reference solution run against 8 test cases: 8 passed
- Passed: 3 worked examples confirmed by running the code
- Passed: 0 eight-word sequences shared with the parent problem's text
- Passed: Agrees with an independent brute-force solution on random inputs
- Passed: Test set shown to catch deliberately broken solutions
- Passed: Reviewed by a separate quality pass
- Passed: Function arity matches the parent problem's