shlogg · Early preview
Md Ariful Haque @mah-shamim

Minimum Obstacles To Reach Corner In Grid

Model grid as graph, use 0-1 BFS or Dijkstra's algorithm to minimize obstacles removal from top-left to bottom-right corner.

2290. Minimum Obstacle Removal to Reach Corner
Difficulty: Hard
Topics: Array, Breadth-First Search, Graph, Heap (Priority Queue), Matrix, Shortest Path
You are given a 0-indexed 2D integer array grid of size m x n. Each cell has one of two values:

0 represents an empty cell,
1 represents an obstacle that may be removed.

You can move up, down, left, or right from and to an empty cell.
Return the minimum number of obstacles to remove so you can move from the upper left corner (0, 0) to the lower right corner (m - 1, n - 1).
Example 1:


Input: grid = [[0,1,1],[1,1,0],[1,1,0]]
Output: 2
Explan...