Challenge Information

Title : Smallest at Position
Difficulty : Medium
Solutions : 9
Maximum Score : 100
Completed by You: No
Description :

An array is given containing positive integers and all are distinct. Find the Kth smallest integer in the array. The value of K is also given.

Write a function solve that have the following parameter(s):
1.) a = integer representing position in array
2.) arr = array of integers

Example
Input:
K = 3
arr = [2,5,9,11,8]
Output:
The function will return,
8

Explanation
3rd smallest element is 8 in the given array.

Constraints


Judocode