MCPcopy Create free account
hub / github.com/Hsinha11/Leetcode-solutions / solve

Method solve

-51-N_Queens/Code.py:36–45  ·  view source on GitHub ↗
(self, board, n, col, v, ans)

Source from the content-addressed store, hash-verified

34 ans.append(arr)
35
36 def solve(self, board, n, col, v, ans):
37 if col == n:
38 self.addSol(board, n, ans)
39 return
40
41 for row in range(n):
42 if self.isSafe(board, row, col):
43 board[row][col] = 1
44 self.solve(board, n, col + 1, v, ans)
45 board[row][col] = 0
46
47 def solveNQueens(self, n):
48 board = [[0] * n for _ in range(n)]

Callers 1

solveNQueensMethod · 0.95

Calls 2

addSolMethod · 0.95
isSafeMethod · 0.95

Tested by

no test coverage detected