Solving Kth Largest Element in an Array
To see the question, click here.
Naive Approach
To find the kth largest element, we can first sort the array and then return the nums.length - k th element.
// TC: O(nlogn)
// SC: O(1)
import java.util.Arrays;
class KthLargestElement {
public ...
vineethchivukula.hashnode.dev5 min read