mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
48 lines
1.2 KiB
HTML
48 lines
1.2 KiB
HTML
<p>给你一个整数数组 <code>nums</code> ,该数组具有以下属性:</p>
|
||
|
||
<div class="original__bRMd">
|
||
<div>
|
||
<ul>
|
||
<li><code>nums.length == 2 * n</code>.</li>
|
||
<li><code>nums</code> 包含 <code>n + 1</code> 个 <strong>不同的</strong> 元素</li>
|
||
<li><code>nums</code> 中恰有一个元素重复 <code>n</code> 次</li>
|
||
</ul>
|
||
|
||
<p>找出并返回重复了 <code>n</code><em> </em>次的那个元素。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>nums = [1,2,3,3]
|
||
<strong>输出:</strong>3
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>nums = [2,1,2,5,3,2]
|
||
<strong>输出:</strong>2
|
||
</pre>
|
||
|
||
<p><strong>示例 3:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>nums = [5,1,5,2,5,3,5,4]
|
||
<strong>输出:</strong>5
|
||
</pre>
|
||
</div>
|
||
</div>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>2 <= n <= 5000</code></li>
|
||
<li><code>nums.length == 2 * n</code></li>
|
||
<li><code>0 <= nums[i] <= 10<sup>4</sup></code></li>
|
||
<li><code>nums</code> 由 <code>n + 1</code> 个<strong> 不同的</strong> 元素组成,且其中一个元素恰好重复 <code>n</code> 次</li>
|
||
</ul>
|