Available question text
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.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 505. The Maze II
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source