Search
⌘K
Get Premium
Leetcode 505. The Maze II
Given a grid maze where a ball, when moved in any direction, keeps rolling until it hits a wall (it cannot stop mid-roll), compute the minimum number of steps needed to reach a destination cell (or -1 if unreachable). This is a shortest-path problem on a graph with edge costs equal to roll distances, typically solved with Dijkstra (or BFS with a priority queue) while tracking minimum distances to each cell.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.