Snakes and Ladders (LeetCode 909, BFS).
Asked in the DSA stage. Implement the shortest path in a Snakes and Ladders board where each move is a dice roll from 1 to 6. Given an n x n board, return the minimum number of moves needed to reach square n*n, or -1 if it is unreachable.
def snakes_and_ladders(board):
board: a 2D list of integers, where -1 means a normal square and any positive value is the destination square of a snake or ladder.def snakes_and_ladders(board):