-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram66.java
More file actions
42 lines (25 loc) · 1000 Bytes
/
program66.java
File metadata and controls
42 lines (25 loc) · 1000 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
51. N-Queens
Hard
10.1K
223
Companies
The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other.
Given an integer n, return all distinct solutions to the n-queens puzzle. You may return the answer in any order.
Each solution contains a distinct board configuration of the n-queens' placement, where 'Q' and '.' both indicate a queen and an empty space, respectively.
Example 1:
Input: n = 4
Output: [[".Q..","...Q","Q...","..Q."],["..Q.","Q...","...Q",".Q.."]]
Explanation: There exist two distinct solutions to the 4-queens puzzle as shown above
Example 2:
Input: n = 1
Output: [["Q"]]
*/
package LeetCode;
public class program66 {
public List<List<String>> solveNQueens(int n) {
List<List<String>>ls = new List<>();
List<String>obj = new List<>();
return ls;
}
}