Does calling the sort() method count as cheat?

  • 0

    Simply sort the array and return k - 1 element. 2 lines AC.

        def findKthLargest(self, nums, k):
            return nums[k - 1]

Log in to reply

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