Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding
Ninjas X Naukri.com

Problem of the day

You are given an array of integers * 'ARR'* of size

Your task is to find and return 'K'th smallest value present in the array.

Note: All the elements in the array are distinct.

```
If 'N' is 5 and 'K' is 3 and the array is 7, 2, 6, 1, 9
Sorting the array we get 1, 2, 6, 7, 9
Hence the 3rd smallest number is 6.
```

Detailed explanation

```
7 5
5 9 1 8 10 6 4
```

```
8
```

```
Sorted array will be 1 4 5 6 8 9 10, this shows that 8 is the fifth-smallest element in the array.
```

```
7 2
24 8 23 28 3 1 19
```

```
3
```

```
1 <= N <=10 ^ 4
1 <= K <= N
1 <= ARR[i] <= 10 ^ 9
Time limit: 1 sec.
```