1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/最小的k个数 [zui-xiao-de-kge-shu-lcof].html
2022-03-29 12:43:11 +08:00

24 lines
658 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>输入整数数组 <code>arr</code> ,找出其中最小的 <code>k</code> 个数。例如输入4、5、1、6、2、7、3、8这8个数字则最小的4个数字是1、2、3、4。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>arr = [3,2,1], k = 2
<strong>输出:</strong>[1,2] 或者 [2,1]
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>arr = [0,1,2,1], k = 1
<strong>输出:</strong>[0]</pre>
<p>&nbsp;</p>
<p><strong>限制:</strong></p>
<ul>
<li><code>0 &lt;= k &lt;= arr.length &lt;= 10000</code></li>
<li><code>0 &lt;= arr[i]&nbsp;&lt;= 10000</code></li>
</ul>