Skip to content

Commit cb93bed

Browse files
authored
Create Solution3.py
1 parent df80a19 commit cb93bed

File tree

1 file changed

+7
-0
lines changed
  • solution/0200-0299/0215.Kth Largest Element in an Array

1 file changed

+7
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Solution:
2+
def findKthLargest(self, nums: List[int], k: int) -> int:
3+
cnt = Counter(nums)
4+
for i in count(max(cnt), -1):
5+
k -= cnt[i]
6+
if k <= 0:
7+
return i

0 commit comments

Comments
 (0)