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

Method addSol

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

Source from the content-addressed store, hash-verified

29 }
30
31 public void addSol(int[][] board, int n, List<List<String>> ans) {
32 List<String> arr = new ArrayList<>();
33 for (int i = 0; i < n; i++) {
34 StringBuilder str = new StringBuilder();
35 for (int j = 0; j < n; j++) {
36 if (board[i][j] == 1)
37 str.append('Q');
38 else
39 str.append('.');
40 }
41 arr.add(str.toString());
42 }
43 ans.add(arr);
44 }
45
46 public void solve(int[][] board, int n, int col, List<String> v, List<List<String>> ans) {
47 if (col == n) {

Callers 1

solveMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected