mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 03:33:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			34 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>给你一个整数数组 <code>arr</code>。你可以从中选出一个整数集合,并删除这些整数在数组中的每次出现。</p>
 | 
						||
 | 
						||
<p>返回 <strong>至少</strong> 能删除数组中的一半整数的整数集合的最小大小。</p>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>示例 1:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>arr = [3,3,3,3,5,5,5,2,2,7]
 | 
						||
<strong>输出:</strong>2
 | 
						||
<strong>解释:</strong>选择 {3,7} 使得结果数组为 [5,5,5,2,2]、长度为 5(原数组长度的一半)。
 | 
						||
大小为 2 的可行集合有 {3,5},{3,2},{5,2}。
 | 
						||
选择 {2,7} 是不可行的,它的结果数组为 [3,3,3,3,5,5,5],新数组长度大于原数组的二分之一。
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例 2:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>arr = [7,7,7,7,7,7]
 | 
						||
<strong>输出:</strong>1
 | 
						||
<strong>解释:</strong>我们只能选择集合 {7},结果数组为空。
 | 
						||
</pre>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>提示:</strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li><code>1 <= arr.length <= 10<sup>5</sup></code></li>
 | 
						||
	<li><code>arr.length</code> 为偶数</li>
 | 
						||
	<li><code>1 <= arr[i] <= 10<sup>5</sup></code></li>
 | 
						||
</ul>
 |