Code RoomMinimum obstacle removals
MediumPrep Room Coding #823

Minimum obstacle removals

CodingAlgorithms & data structuresMid–Senior~30 min

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]]) → int
Examples
in[[[0,1,1],[1,1,0],[1,1,0]]]out2
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 30 min
InputExpectedGot
[[[0,1,1],[1,1,0],[1,1,0]]]2not run yetsample