Code RoomWarehouse bay inventory
EasyPrep Room Coding #4700

Warehouse bay inventory

CodingAlgorithms & data structuresEntry–Mid~14 min

A warehouse aisle is recorded as a rectangular grid. Each row is a shelf level read from top to bottom, and each column is a bay. shelf_map[level][bay] holds the carton count sitting on that level of that bay, or -1 when that level is sealed for an inventory audit and cannot be counted. Return one number per bay, left to right: the total cartons across that bay's unsealed levels. A bay whose levels are all sealed reports -1 instead of a total, because 0 is a real answer for a bay that is simply open and empty. An aisle with no levels, or levels with no bays, returns an empty list.

Implement
bay_load_totals(shelf_map: list[list[int]]) → list[int]
Examples
in[[[3,-1,0],[2,4,0],[1,-1,5]]]out[6,4,5]
in[[[-1,7],[-1,0]]]out[-1,7]
in[[[0,0]]]out[0,0]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 14 min
InputExpectedGot
[[[3,-1,0],[2,4,0],[1,-1,5]]][6,4,5]not run yetsample
[[[-1,7],[-1,0]]][-1,7]not run yetsample
[[[0,0]]][0,0]not run yetsample