Kth Smallest Element in an Array

Medium Problems DSA practice problem on Onlearn.

Difficulty: easy.

Topics: Find the Kth Largest and Kth Smallest Element in an Unsorted Array, Arrays, Sorting, Heap/Priority Queue, Quickselect Algorithm, sorting algorithms, heap, array partitioning, quickselect algorithm, time complexity analysis, Kth Largest/Smallest Element (Quickselect).

Kth Largest and Smallest Element in an Array Problem Statement: Given an unsorted array of integers, find both the Kth largest and Kth smallest elements. Input Format: First line contains an integer array (space separated) Second line contains integer K (1 ≤ K ≤ array length) Output Format: Two space separated integers: Kth largest element followed by Kth smallest element Constraints: 1 ≤ Array length ≤ 10^5 10^9 ≤ Array elements ≤ 10^9 K will always be valid Examples: Difficulty: Medium