Tried to solve part 2 using BFS, but did not figure out a way to find shortest path. Fell back to a less elegant but more simple approach.