first thought
- Using BFS
- How to maintain the distance of each position. => Build a
int[][]
. - The first reach of destination may not be the best solution, but there’s no need to put destination to the queue(aka there’s no need to continue iterating from destination)
solution
|
|