My 45ms Python solution

  • 0

    class Solution(object):
    def findKthLargest(self, nums, k):
    :type nums: List[int]
    :type k: int
    :rtype: int
    return nums[-k]

  • 1

    Interestingly, this O(nlogn) solution is somehow comparable to O(n) quick select solution's performance. But it will fail interview, almost for sure. LOL

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.