2
def snakesAndLadders(self, board: List[List[int]]) -> int:5
q = collections.deque([1])6
visited = [[False for _ in range(n)] for _ in range(n)]7
visited[n - 1][0] = True11
currBoardVal = q.popleft()12
if currBoardVal == n * n:14
for diceVal in range(1, 7):15
if currBoardVal + diceVal > n * n:17
pos = self.findCoordinates(currBoardVal + diceVal, n)19
if not visited[row][col]:20
visited[row][col] = True21
if board[row][col] == -1:22
q.append(currBoardVal + diceVal)24
q.append(board[row][col])28
def findCoordinates(self, curr: int, n: int) -> Tuple[int, int]:29
row = n - (curr - 1) // n - 132
return (row, n - 1 - col)