Try all paths using DFS, tracking the shortest one found.
DFS explores deep before backtracking, potentially visiting many long paths before finding the shortest.
BFS explores level by level, guaranteeing the first path found is the shortest.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
The trap
Try all paths using DFS, tracking the shortest one found.
DFS explores deep before backtracking, potentially visiting many long paths before finding the shortest.
BFS explores level by level, guaranteeing the first path found is the shortest.