Kth Smallest Element in the Array

Find the kth smallest element in an unsorted array of non-negative integers.

Definition of kth smallest element

kth smallest element is the minimum possible n such that there are at least k elements in the array <= n.
In other words, if the array A was sorted, then A[k - 1] ( k is 1 based, while the arrays are 0 based )

You are not allowed to modify the array ( The array is read only ).
Try to do it using constant extra space.


A : [2 1 4 3 2]
k : 3

answer : 2
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Kth Smallest Element in the Array on Interview Code Editor
  • No Hints for Checkpoint Problems
Click here to start solving coding interview questions