Array | Kth smallest element | Geeksforgeeks | Python

Given an array arr[] and a number K where K is smaller than size of array, the task is to find the Kth smallest element in the given array. It is given that all array elements are distinct.


t= int(input())
for i in range(t):
    n = int(input())
    arr = list(map(int,input().split()))
    arr.sort()
    f = int(input())
    print(arr[f-1])



Comments