mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 11:21:42 +08:00
add leetcode problem-cn part2
This commit is contained in:
21
算法题(国内版)/problem (Chinese)/八皇后 [eight-queens-lcci].html
Normal file
21
算法题(国内版)/problem (Chinese)/八皇后 [eight-queens-lcci].html
Normal file
@@ -0,0 +1,21 @@
|
||||
<p>设计一种算法,打印 N 皇后在 N × N 棋盘上的各种摆法,其中每个皇后都不同行、不同列,也不在对角线上。这里的“对角线”指的是所有的对角线,不只是平分整个棋盘的那两条对角线。</p>
|
||||
|
||||
<p><strong>注意:</strong>本题相对原题做了扩展</p>
|
||||
|
||||
<p><strong>示例:</strong></p>
|
||||
|
||||
<pre><strong> 输入</strong>:4
|
||||
<strong> 输出</strong>:[[".Q..","...Q","Q...","..Q."],["..Q.","Q...","...Q",".Q.."]]
|
||||
<strong> 解释</strong>: 4 皇后问题存在如下两个不同的解法。
|
||||
[
|
||||
[".Q..", // 解法 1
|
||||
"...Q",
|
||||
"Q...",
|
||||
"..Q."],
|
||||
|
||||
["..Q.", // 解法 2
|
||||
"Q...",
|
||||
"...Q",
|
||||
".Q.."]
|
||||
]
|
||||
</pre>
|
Reference in New Issue
Block a user