1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/含有 k 个元素的组合 [uUsW3B].html
2022-03-29 12:43:11 +08:00

37 lines
803 B
HTML

<p>给定两个整数 <code>n</code><code>k</code>,返回 <code>1 ... n</code> 中所有可能的 <code>k</code> 个数的组合。</p>
<p>&nbsp;</p>
<p><strong>示例 1:</strong></p>
<pre>
<strong>输入:</strong>&nbsp;n = 4, k = 2
<strong>输出:</strong>
[
[2,4],
[3,4],
[2,3],
[1,2],
[1,3],
[1,4],
]</pre>
<p><strong>示例 2:</strong></p>
<pre>
<strong>输入:</strong>&nbsp;n = 1, k = 1
<strong>输出: </strong>[[1]]</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n &lt;= 20</code></li>
<li><code>1 &lt;= k &lt;= n</code></li>
</ul>
<p>&nbsp;</p>
<p><meta charset="UTF-8" />注意:本题与主站 77&nbsp;题相同:&nbsp;<a href="https://leetcode-cn.com/problems/combinations/">https://leetcode-cn.com/problems/combinations/</a></p>