In the Disconnect Path in a Binary Matrix by at Most One Flip coding problem, you are given a binary grid where 1 represents a passable cell and 0 represents a wall. You can move only down or right from to . You need to determine if it is possible to make the destination unreachable from the start by flipping at most one '1' cell (excluding the start and end).
Google uses this problem to test a candidate's understanding of Graph Connectivity and Critical Path analysis. It evaluations whether you can identify a "bottleneck" in a grid. If there is any point in time (any Manhattan distance from the start) where only one path exists, flipping that cell disconnects the graph. It’s a sophisticated test of grid traversal logic.
There are two main ways to solve this:
Grid:
1 1 1
1 0 1
1 1 1
Paths from (0,0) to (2,2):
true.For grid problems involving "reachability" and "moving only down/right," always think about the invariant. Elements with the same sum are at the same "step" from the start. If only one valid cell exists at a particular step, that cell is a critical bottleneck.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Find All Groups of Farmland | Medium | Solve | |
| Coloring A Border | Medium | Solve | |
| Minimum Moves to Spread Stones Over Grid | Medium | Solve | |
| Minesweeper | Medium | Solve | |
| Pacific Atlantic Water Flow | Medium | Solve |