Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write a program to find the kth smallest element in an unsorted array.

Hard

Problem Statement

Write a program to find the kth smallest element in an unsorted array.

Sample Input

Array: [7, 10, 4, 3, 20, 15]
k = 3

Sample Output

Kth Smallest Element: 7

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
function kthSmallest(arr: number[], k: number): number { // Your logic here }
Log in or sign up to run or submit your code.Log inSign up
Input
Array: [7, 10, 4, 3, 20, 15]
k = 3
Expected Output
Kth Smallest Element: 7