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

Method solve

-51-N_Queens/Code.cpp:32–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30 }
31
32 void solve(vector<vector<int>>& board, int n, int col, vector<string>& v, vector<vector<string>>& ans) {
33 if(col == n) {
34 addSol(board, n, ans);
35 return ;
36 }
37 for(int row = 0; row < n; row++) {
38 if(isSafe(board, row, col)) {
39 board[row][col] = 1;
40 solve(board, n, col + 1, v, ans);
41 board[row][col] = 0;
42 }
43 }
44 }
45
46 vector<vector<string>> solveNQueens(int n) {
47 vector<vector<int>>board(n, vector<int>(n, 0));

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected