Follow up for N-Queens problem.
Now, instead outputting board configurations, return the total number of distinct solutions.
'Q' and '.' both indicate a queen and an empty space respectively.[ [".Q..", // Solution 1 "...Q", "Q...", "..Q."], ["..Q.", // Solution 2 "Q...", "...Q", ".Q.."] ]
'.'.[
[2],
[3,4],
[6,5,7],
[4,1,8,3]
]
11 (i.e., 2 + 3 + 5 + 1 = 11).1 / \ 2 2 / \ / \ 3 4 4 3
1 / \ 2 2 \ \ 3 3
"{1,#,2,3}" means? > read more on how binary tree is serialized on OJ."{1,#,2,3}" means? > read more on how binary tree is serialized on OJ.0-9 only, each root-to-leaf path could represent a number.1->2->3 which represents the number 123.1 / \ 2 3
1->2 represents the number 12.1->3 represents the number 13.25. 1
/ \
2 5
/ \ \
3 4 6
1
/ \
2 3
6. 1
/ \
2 5
/ \ \
3 4 6
1
\
2
\
3
\
4
\
5
\
6
Input:Digit string "23" Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"].