-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnQueen.java
More file actions
26 lines (22 loc) · 791 Bytes
/
nQueen.java
File metadata and controls
26 lines (22 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.util.ArrayList;
import java.util.List;
public class nQueen {
public static void main(String[] args){
}
public List<List<String>> solveNQueens(int n) {
int[][] chessport = new int[n][n];
List<List<String>> result = new ArrayList<>();
List<int[][]> tem = new ArrayList<>();
for(int[][] a : tem) {
for(int i = 0; i < n ; i++) {
StringBuffer stringBuffer = new StringBuffer();
for(int j = 0; j < n; j++) {
if(a[i][j] == 0) stringBuffer.append(".");
else if(a[i][j] == 1) stringBuffer.append("Q");
}
stringBuffer.toString();
}
}
return result;
}
}