Minimum obstacle removals
You are given a grid where grid[r][c] is 0 for an empty cell and 1 for an obstacle. Starting at the top-left (0,0) and moving up/down/left/right, you may eliminate obstacles; return the minimum number of obstacles you must remove to reach the bottom-right corner. Entering an obstacle cell costs one removal. The grid is at least 1x1 and the start/end may themselves be obstacles. Constraints: 1 <= rows, cols <= 100.
Implement
min_obstacles_to_remove(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