Learn
Practice
Newsletter
Resources
Animations
New
F
Toggle theme
0
F
0
Toggle menu
← Back to All Animations
Shortest Path Visiting All Nodes
Bookmark
Input
Standard
Small
Triangle
Custom
graph
=
[[1,2,3],[0],[0],[0]]
0
1
2
3
start
answer = ?
dp[mask][end] — min edges to visit `mask`, ending at `end`
0
1
2
3
mask
algo
master
.
io
Step:
Start: Shortest Path Visiting All 4 Nodes using BFS + Bitmask DP
0 / 123
Input
Standard
Small
Triangle
Custom
graph
=
[[1,2,3],[0],[0],[0]]
0 / 123
0
1
2
3
start
answer = ?
dp[mask][end] — min edges to visit `mask`, ending at `end`
0
1
2
3
mask
algo
master
.
io
Step:
Start: Shortest Path Visiting All 4 Nodes using BFS + Bitmask DP