About 10,100,000 results
Open links in new tab
  1. Kth Largest Element in an Array - LeetCode

    Kth Largest Element in an Array - Given an integer array nums and an integer k, return the kth largest element in the array. Note that it is the kth largest element in the sorted order, not the …

  2. Kth Largest Element in an Array - GeeksforGeeks

    Oct 29, 2025 · The idea is to maintain a min-heap (priority queue) of size K while iterating through the array. This approach ensures that the heap always contains the K largest elements …

  3. 215. Kth Largest Element in an Array - In-Depth Explanation

    When asked to find the k th largest element, the straightforward approach would be to sort the entire array and pick the element at index k-1 (for descending order) or index n-k (for …

  4. Kth Largest Element in an Array - LeetCode

    Kth Largest Element in an Array - Given an integer array nums and an integer k, return the kth largest element in the array. Note that it is the kth largest element in the sorted order, not the …

  5. 215. Kth Largest Element In An Array - Solution & Explanation

    Time & Space Complexity Time complexity: O (n log ⁡ k) O (n \log k) O(nlogk) Space complexity: O (k) O (k) O(k) Where n n is the length of the array n u m s nums.

  6. K’th Smallest Element - GeeksforGeeks

    Oct 18, 2025 · The main idea is to use QuickSelect to find the k-th largest element by picking a pivot and partitioning the array so that all elements greater than the pivot are on the left and …

  7. Find k largest elements in an array - GeeksforGeeks

    Jul 23, 2025 · Given an array arr [] and an integer k, the task is to find k largest elements in the given array. Elements in the output array should be in decreasing order. Examples: The idea is …

  8. 1985. Find the Kth Largest Integer in the Array - LeetCode

    Find the Kth Largest Integer in the Array. You are given an array of strings nums and an integer k. Each string in nums represents an integer without leading zeros. Return the string that …

  9. Kth Largest Element in an Array - NamasteDev Blogs

    Aug 12, 2025 · If the heap size exceeds k, remove the smallest element (heap root). After processing all elements, the heap’s top (smallest in the heap) will be the k-th largest in the array.

  10. 215 - Kth Largest Element in an Array - Leetcode

    Jul 2, 2016 · Given an integer array nums and an integer k, return the k th largest element in the array. Note that it is the k th largest element in the sorted order, not the k th distinct element.