Learn
Practice
Newsletter
Resources
Resume
New
F
Toggle theme
0
F
Toggle theme
0
Toggle menu
← Back to All Animations
Shortest Path in a Grid with Obstacles Elimination
Bookmark
Input
Example 1
Example 2
Small easy
Manhattan shortcut
Custom
grid
=
[[0,0,0],[1,1,0],[0,0,0],[0,1,1],[0,0,0]]
,
k
=
1
0
0
0
1
1
0
0
0
0
0
1
1
0
0
0
queue
Open
Obstacle
Visited
Eliminated
algo
master
.
io
Step:
Start: Find shortest path from (0,0) to (4,2) with at most 1 obstacle eliminations
Variable
Value
grid
Matrix(5x3) [[0,0,0]...]
k
1
m
5
n
3
q
-
Variable
Value
steps
-
remK
-
newRow
-
newCol
-
result
-
0 / 132
Input
Example 1
Example 2
Small easy
Manhattan shortcut
Custom
grid
=
[[0,0,0],[1,1,0],[0,0,0],[0,1,1],[0,0,0]]
,
k
=
1
0 / 132
0
0
0
1
1
0
0
0
0
0
1
1
0
0
0
queue
Open
Obstacle
Visited
Eliminated
algo
master
.
io
Step:
Start: Find shortest path from (0,0) to (4,2) with at most 1 obstacle eliminations
Visualization
Variables