File tree 2 files changed +19
-0
lines changed
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 93
93
206|[ Reverse Linked List] ( ./0206-reverse-linked-list.js ) |Easy|
94
94
213|[ House Robber II] ( ./0213-house-robber-ii.js ) |Medium|
95
95
214|[ Shortest Palindrome] ( ./0214-shortest-palindrome.js ) |Hard|
96
+ 215|[ Kth Largest Element in an Array] ( ./0215-kth-largest-element-in-an-array.js ) |Medium|
96
97
217|[ Contains Duplicate] ( ./0217-contains-duplicate.js ) |Easy|
97
98
219|[ Contains Duplicate II] ( ./0219-contains-duplicate-ii.js ) |Easy|
98
99
225|[ Implement Stack using Queues] ( ./0225-implement-stack-using-queues.js ) |Easy|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * 215. Kth Largest Element in an Array
3
+ * https://leetcode.com/problems/kth-largest-element-in-an-array/
4
+ * Difficulty: Medium
5
+ *
6
+ * Given an integer array nums and an integer k, return the kth largest element in the array.
7
+ *
8
+ * Note that it is the kth largest element in the sorted order, not the kth distinct element.
9
+ */
10
+
11
+ /**
12
+ * @param {number[] } nums
13
+ * @param {number } k
14
+ * @return {number }
15
+ */
16
+ var findKthLargest = function ( nums , k ) {
17
+ return nums . sort ( ( a , b ) => a - b ) [ nums . length - k ] ;
18
+ } ;
You can’t perform that action at this time.
0 commit comments