You are given an maze, where
A ball starts at position start = [start_row, start_col], and you want to determine whether it can stop exactly at position destination = [destination_row, destination_col].
The ball can be rolled in one of the four cardinal directions: up, down, left, or right. Once the ball starts moving, it continues rolling through consecutive empty cells in that direction until it encounters a wall or the boundary of the maze. The ball then stops at the last empty cell before the obstacle.
Because the ball only stops when its movement is blocked, it cannot stop in the middle of an open corridor.
Return TRUE if the ball can eventually stop at destination. Otherwise, return FALSE.
Important: The ball may pass through the
destinationwhile rolling, but this does not count as reaching it. The destination is considered reached only if the ball can stop exactly on that cell.
Constraints:
m == maze.length
n == maze[i].length
m, n
maze[i][j] is
start.length == 2
destination.length == 2
start_row, destination_row
start_col, destination_col
Both the ball and destination are located on empty cells, and they are not initially in the same position.
The maze contains at least
You are given an maze, where
A ball starts at position start = [start_row, start_col], and you want to determine whether it can stop exactly at position destination = [destination_row, destination_col].
The ball can be rolled in one of the four cardinal directions: up, down, left, or right. Once the ball starts moving, it continues rolling through consecutive empty cells in that direction until it encounters a wall or the boundary of the maze. The ball then stops at the last empty cell before the obstacle.
Because the ball only stops when its movement is blocked, it cannot stop in the middle of an open corridor.
Return TRUE if the ball can eventually stop at destination. Otherwise, return FALSE.
Important: The ball may pass through the
destinationwhile rolling, but this does not count as reaching it. The destination is considered reached only if the ball can stop exactly on that cell.
Constraints:
m == maze.length
n == maze[i].length
m, n
maze[i][j] is
start.length == 2
destination.length == 2
start_row, destination_row
start_col, destination_col
Both the ball and destination are located on empty cells, and they are not initially in the same position.
The maze contains at least