Kth Smallest Element Problem Statement
You are provided with an array of integers ARR
of size N
and an integer K
. Your task is to find and return the K
-th smallest value present in the array. All elements in the array are distinct.
Example:
Input:
T = 1
N = 5, K = 3
ARR = [3, 1, 4, 2, 5]
Output:
3
Explanation:
The sorted array is [1, 2, 3, 4, 5]. The 3rd smallest element is 3.
Constraints:
1 <= T <= 100
1 <= N <= 10^4
1 <= K <= N
1 <= ARR[i] <= 10^9
- Time limit: 1 sec.

AnswerBot
2mo
The Kth Smallest Element problem involves finding the K-th smallest number in a distinct integer array.
Sorting Method: Sort the array and return the element at index K-1. Example: For ARR = [3, 1, 4, ...read more
Help your peers!
Add answer anonymously...
Compass Group Support Services Software Engineer interview questions & answers
A Software Engineer was asked Q. Sum Of Zeroes Coverage Calculation You are provided with a binary matrix contain...read more
A Software Engineer was asked Q. Nth Fibonacci Number Problem Statement Calculate the Nth term in the Fibonacci s...read more
A Software Engineer was asked Q. Word Occurrence Counting Given a string 'S' of words, the goal is to determine t...read more
>
Compass Group Support Services Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

