Pallet recall
A supplier recalls specific pallets in a warehouse. You get the current unit counts per slot and a list of slot indices that were recalled. Set the count at every recalled index to 0 and return the updated list. Every index in the recall list is a valid position, and the same index may appear more than once. Example: counts [5, 3, 8] with recalls [0, 2] become [0, 3, 0].
Implement
zero_recalled(counts: list[int], recalled: list[int]) → list[int]Examples
in
[[5,3,8],[0,2]]out[0,3,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 10 min
solution.py
InputExpectedGot
[[5,3,8],[0,2]][0,3,0]not run yetsample