mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
28 lines
727 B
HTML
28 lines
727 B
HTML
<p>仓库管理员以数组 <code>stock</code> 形式记录商品库存表,其中 <code>stock[i]</code> 表示对应商品库存余量。请返回库存余量最少的 <code>cnt</code> 个商品余量,返回 <strong>顺序不限</strong>。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>stock = [2,5,7,4], cnt = 1
|
||
<strong>输出:</strong>[2]
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>stock = [0,2,3,6], cnt = 2
|
||
<strong>输出:</strong>[0,2] 或 [2,0]</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>0 <= cnt <= stock.length <= 10000<br />
|
||
0 <= stock[i] <= 10000</code></li>
|
||
</ul>
|
||
|
||
<p> </p>
|