mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-06 16:01:41 +08:00
存量题库数据更新
This commit is contained in:
@@ -1,28 +1,23 @@
|
||||
<p>Given two integers <code>n</code> and <code>k</code>, return <em>all possible combinations of</em> <code>k</code> <em>numbers out of the range</em> <code>[1, n]</code>.</p>
|
||||
<p>Given two integers <code>n</code> and <code>k</code>, return <em>all possible combinations of</em> <code>k</code> <em>numbers chosen from the range</em> <code>[1, n]</code>.</p>
|
||||
|
||||
<p>You may return the answer in <strong>any order</strong>.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> n = 4, k = 2
|
||||
<strong>Output:</strong>
|
||||
[
|
||||
[2,4],
|
||||
[3,4],
|
||||
[2,3],
|
||||
[1,2],
|
||||
[1,3],
|
||||
[1,4],
|
||||
]
|
||||
<strong>Output:</strong> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
|
||||
<strong>Explanation:</strong> There are 4 choose 2 = 6 total combinations.
|
||||
Note that combinations are unordered, i.e., [1,2] and [2,1] are considered to be the same combination.
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> n = 1, k = 1
|
||||
<strong>Output:</strong> [[1]]
|
||||
<strong>Explanation:</strong> There is 1 choose 1 = 1 total combination.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
Reference in New Issue
Block a user