You are given an integer array nums and an integer k.
Your task is to find and return the kth largest element in the array.
You may assume that:
nums is non-empty.k is a valid integer such that 1 <= k <= nums.length.Return the kth largest element as an integer.
nums = [3, 1, 2]
k = 2
2
The largest element is 3, the 2nd largest is 2.
nums = [1, 3, 2, 1, 3]
k = 3
2
The largest element is 3, the 2nd largest is also 3, and the 3rd largest is 2.
nums = [3, 1, 2]
k = 2
2