Skip to content

Commit 3215d98

Browse files
committedMay 9, 2024
Create README - LeetHub
1 parent 2ab21ab commit 3215d98

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
 

‎0051-n-queens/README.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<h2><a href="https://leetcode.com/problems/n-queens">51. N-Queens</a></h2><h3>Hard</h3><hr><p>The <strong>n-queens</strong> puzzle is the problem of placing <code>n</code> queens on an <code>n x n</code> chessboard such that no two queens attack each other.</p>
2+
3+
<p>Given an integer <code>n</code>, return <em>all distinct solutions to the <strong>n-queens puzzle</strong></em>. You may return the answer in <strong>any order</strong>.</p>
4+
5+
<p>Each solution contains a distinct board configuration of the n-queens&#39; placement, where <code>&#39;Q&#39;</code> and <code>&#39;.&#39;</code> both indicate a queen and an empty space, respectively.</p>
6+
7+
<p>&nbsp;</p>
8+
<p><strong class="example">Example 1:</strong></p>
9+
<img alt="" src="https://assets.leetcode.com/uploads/2020/11/13/queens.jpg" style="width: 600px; height: 268px;" />
10+
<pre>
11+
<strong>Input:</strong> n = 4
12+
<strong>Output:</strong> [[&quot;.Q..&quot;,&quot;...Q&quot;,&quot;Q...&quot;,&quot;..Q.&quot;],[&quot;..Q.&quot;,&quot;Q...&quot;,&quot;...Q&quot;,&quot;.Q..&quot;]]
13+
<strong>Explanation:</strong> There exist two distinct solutions to the 4-queens puzzle as shown above
14+
</pre>
15+
16+
<p><strong class="example">Example 2:</strong></p>
17+
18+
<pre>
19+
<strong>Input:</strong> n = 1
20+
<strong>Output:</strong> [[&quot;Q&quot;]]
21+
</pre>
22+
23+
<p>&nbsp;</p>
24+
<p><strong>Constraints:</strong></p>
25+
26+
<ul>
27+
<li><code>1 &lt;= n &lt;= 9</code></li>
28+
</ul>

0 commit comments

Comments
 (0)
Please sign in to comment.