Given an m $ imes$ n 2D binary matrix grid, a robot begins at the top left cell (0, 0) and wants to reach the bottom right cell (m - 1, n - 1).
From any cell with a value of
Move right
Move down
Cells with a value of
Entering a mirror while moving right deflects the robot downward.
Entering a mirror while moving down deflects the robot rightward.
If the deflected destination is another mirror, the robot continues to deflect according to its current direction of movement until it lands on an empty cell containing
Any path that moves outside the boundaries of the grid is invalid.
Return the total number of unique paths from (0, 0) to (m - 1, n - 1).
Constraints:
m == grid.length
n == grid[i].length
m, n
grid[i][j] is either
grid[0][0] == grid[m - 1][n - 1] == 0
Given an m $ imes$ n 2D binary matrix grid, a robot begins at the top left cell (0, 0) and wants to reach the bottom right cell (m - 1, n - 1).
From any cell with a value of
Move right
Move down
Cells with a value of
Entering a mirror while moving right deflects the robot downward.
Entering a mirror while moving down deflects the robot rightward.
If the deflected destination is another mirror, the robot continues to deflect according to its current direction of movement until it lands on an empty cell containing
Any path that moves outside the boundaries of the grid is invalid.
Return the total number of unique paths from (0, 0) to (m - 1, n - 1).
Constraints:
m == grid.length
n == grid[i].length
m, n
grid[i][j] is either
grid[0][0] == grid[m - 1][n - 1] == 0