mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
23 lines
755 B
HTML
23 lines
755 B
HTML
<p>仓库管理员以数组 <code>stock</code> 形式记录商品库存表。<code>stock[i]</code> 表示商品 <code>id</code>,可能存在重复。请返回库存表中数量大于 <code>stock.length / 2</code> 的商品 <code>id</code>。</p>
|
|
|
|
<p> </p>
|
|
|
|
<p><strong>示例 1:</strong></p>
|
|
|
|
<pre>
|
|
<strong>输入: </strong>stock = [6, 1, 3, 1, 1, 1]
|
|
<strong>输出: </strong>1</pre>
|
|
|
|
<p> </p>
|
|
|
|
<p><strong>限制:</strong></p>
|
|
|
|
<ul>
|
|
<li><code>1 <= stock.length <= 50000</code></li>
|
|
<li>给定数组为非空数组,且存在结果数字</li>
|
|
</ul>
|
|
|
|
<p> </p>
|
|
|
|
<p>注意:本题与主站 169 题相同:<a href="https://leetcode-cn.com/problems/majority-element/">https://leetcode-cn.com/problems/majority-element/</a></p>
|