Minimum obstacle removal
A robot starts at the top-left of an R x C grid and wants to reach the bottom-right. Cell value 0 is open and 1 is an obstacle; the robot may remove obstacles but wants to remove as few as possible. Moving to an adjacent cell (up/down/left/right) costs one removal if that cell is an obstacle, nothing if it's open. Entering the start or end cell also counts if it happens to be an obstacle. Return the minimum number of obstacles that must be removed to reach the bottom-right cell.
Implement
min_obstacles(grid: list[list[int]]) → intExamples
in
[[[0,1,1],[1,1,0],[1,1,0]]]out2What 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 30 min
solution.py
InputExpectedGot
[[[0,1,1],[1,1,0],[1,1,0]]]2not run yetsample