929 Number Maze, Dijkstra's priority queue with custom comparison