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
4mo
Find the K-th smallest element in an array of distinct integers.
Sort the array and return the element at index K-1.
Use a min-heap to find the K-th smallest element efficiently.
Implement quickselect al...read more
Help your peers!
Add answer anonymously...
Jaguar Land Rover Software Developer interview questions & answers
A Software Developer was asked Q. SELL ABD BUY 1 array question(easy level)
A Software Developer was asked Q. Beautiful String Verification Given a non-empty string inputString, determine if...read more
A Software Developer was asked Q. K Centers Selection Problem In Ninja Land, there are cities numbered from 0 to N...read more
Popular interview questions of Software Developer
A Software Developer was asked Q1. SELL ABD BUY 1 array question(easy level)
A Software Developer was asked Q2. Beautiful String Verification Given a non-empty string inputString, determine if...read more
A Software Developer was asked Q3. K Centers Selection Problem In Ninja Land, there are cities numbered from 0 to N...read more
>
Jaguar Land Rover Software Developer 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

