Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

0-1 BFS: Minimum Obstacle Removal

In an R x C grid, 0 is an empty cell and 1 is an obstacle. You may remove obstacles. Print the minimum number of obstacles to remove to travel from the top-left to the bottom-right cell with 4-directional moves.

Constraints

1 <= R, C <= 1000 The start and end cells are 0

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.