Skip to content

Latest commit

 

History

History
14 lines (11 loc) · 207 Bytes

kth-largest-element-in-an-array.md

File metadata and controls

14 lines (11 loc) · 207 Bytes

Code

func findKthLargest(nums []int, k int) int {
	sort.Ints(nums)
	return nums[len(nums)-k]
}

Solution in mind

  • Sort given array and return the kth element from the end.