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

Method solve

-51-N_Queens/Code.java:46–59  ·  view source on GitHub ↗
(int[][] board, int n, int col, List<String> v, List<List<String>> ans)

Source from the content-addressed store, hash-verified

44 }
45
46 public void solve(int[][] board, int n, int col, List<String> v, List<List<String>> ans) {
47 if (col == n) {
48 addSol(board, n, ans);
49 return;
50 }
51
52 for (int row = 0; row < n; row++) {
53 if (isSafe(board, row, col)) {
54 board[row][col] = 1;
55 solve(board, n, col + 1, v, ans);
56 board[row][col] = 0;
57 }
58 }
59 }
60
61 public List<List<String>> solveNQueens(int n) {
62 int[][] board = new int[n][n];

Callers 1

solveNQueensMethod · 0.95

Calls 2

addSolMethod · 0.95
isSafeMethod · 0.95

Tested by

no test coverage detected