Kth Largest Element in an Array

Problem Id: 215 Difficulty: Medium


Intuition

Solution


class Solution:
    def findKthLargest(self, nums: 'List[int]', k: 'int') -> 'int':
        nums.sort()
        return nums[-k]