You are given an board representing a Snakes and Ladders game. The cells correspond to squares labeled from
The game is played as follows:
You start on square
In one move, you roll a die and choose a destination square with a label in the range from your current label +
After moving to that square, if the corresponding cell in board contains a value other than
Return the minimum number of moves required to reach square
Note: If the destination of a snake or ladder is the start of another snake or ladder, only the first jump is applied. For example, if 2 → 5 and 5 → 8, landing on 2 moves you to 5, not 8.
Constraints:
n == board.length == board[i].length
n
board[i][j] is either
The squares labeled
You are given an board representing a Snakes and Ladders game. The cells correspond to squares labeled from
The game is played as follows:
You start on square
In one move, you roll a die and choose a destination square with a label in the range from your current label +
After moving to that square, if the corresponding cell in board contains a value other than
Return the minimum number of moves required to reach square
Note: If the destination of a snake or ladder is the start of another snake or ladder, only the first jump is applied. For example, if 2 → 5 and 5 → 8, landing on 2 moves you to 5, not 8.
Constraints:
n == board.length == board[i].length
n
board[i][j] is either
The squares labeled