mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 03:33:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			31 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>You are given an integer array <code>nums</code> with the following properties:</p>
 | 
						|
 | 
						|
<ul>
 | 
						|
	<li><code>nums.length == 2 * n</code>.</li>
 | 
						|
	<li><code>nums</code> contains <code>n + 1</code> <strong>unique</strong> elements.</li>
 | 
						|
	<li>Exactly one element of <code>nums</code> is repeated <code>n</code> times.</li>
 | 
						|
</ul>
 | 
						|
 | 
						|
<p>Return <em>the element that is repeated </em><code>n</code><em> times</em>.</p>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
<p><strong class="example">Example 1:</strong></p>
 | 
						|
<pre><strong>Input:</strong> nums = [1,2,3,3]
 | 
						|
<strong>Output:</strong> 3
 | 
						|
</pre><p><strong class="example">Example 2:</strong></p>
 | 
						|
<pre><strong>Input:</strong> nums = [2,1,2,5,3,2]
 | 
						|
<strong>Output:</strong> 2
 | 
						|
</pre><p><strong class="example">Example 3:</strong></p>
 | 
						|
<pre><strong>Input:</strong> nums = [5,1,5,2,5,3,5,4]
 | 
						|
<strong>Output:</strong> 5
 | 
						|
</pre>
 | 
						|
<p> </p>
 | 
						|
<p><strong>Constraints:</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> contains <code>n + 1</code> <strong>unique</strong> elements and one of them is repeated exactly <code>n</code> times.</li>
 | 
						|
</ul>
 |