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!
Select
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
play-icon
play-icon
qr-code
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

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits