Array Question 13

Home / Java Practice Question / Array Question 13

Array Question 13


Question 28. Write a Program  to print kth largest element.

Program 


class Solution {

    public int findKthLargest(int[] nums, int k) {

        Arrays.sort(nums);

        return nums[nums.length - k];

    }

}