mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 11:43:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			32 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>给定整数数组 <code>nums</code> 和整数 <code>k</code>,请返回数组中第 <code><strong>k</strong></code> 个最大的元素。</p>
 | 
						||
 | 
						||
<p>请注意,你需要找的是数组排序后的第 <code>k</code> 个最大的元素,而不是第 <code>k</code> 个不同的元素。</p>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>示例 1:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>nums = [3,2,1,5,6,4], k = 2
 | 
						||
<strong>输出:</strong>5
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例 2:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>nums = [3,2,3,1,2,4,5,5,6], k = 4
 | 
						||
<strong>输出:</strong>4</pre>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>提示: </strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li><code>1 <= k <= nums.length <= 10<sup>4</sup></code></li>
 | 
						||
	<li><code>-10<sup>4</sup> <= nums[i] <= 10<sup>4</sup></code></li>
 | 
						||
</ul>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><meta charset="UTF-8" />注意:本题与主站 215 题相同: <a href="https://leetcode-cn.com/problems/kth-largest-element-in-an-array/">https://leetcode-cn.com/problems/kth-largest-element-in-an-array/</a></p>
 |