Class Solution
java.lang.Object
g0201_0300.s0215_kth_largest_element_in_an_array.Solution
215 - Kth Largest Element in an Array.<p>Medium</p>
<p>Given an integer array <code>nums</code> and an integer <code>k</code>, return <em>the</em> <code>k<sup>th</sup></code> <em>largest element in the array</em>.</p>
<p>Note that it is the <code>k<sup>th</sup></code> largest element in the sorted order, not the <code>k<sup>th</sup></code> distinct element.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> nums = [3,2,1,5,6,4], k = 2</p>
<p><strong>Output:</strong> 5</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> nums = [3,2,3,1,2,4,5,5,6], k = 4</p>
<p><strong>Output:</strong> 4</p>
<p><strong>Constraints:</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>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
findKthLargest
public int findKthLargest(int[] nums, int k)
-