# Problem 29

### 6 comments on “Problem 29”

• Pallipattu

n=list(map(int,input().split()))
k=int(input())
n.sort()
print(n[k-1])

• sunny

python :
arr=[7,10,4,3,20,15]
k=int(input())
arr=sorted(arr)
print(arr[k-1])

• shushank

Python

l=list(map(int,input().split(” “)))
k=int(input())
l.sort()
print(l[k-1])

• Santhosh

package com.prepInsta.nqt;
import java.util.*;
public class SelectionSort {

public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println(“entert the range”);
int n=sc.nextInt();
int a[]=new int[n];
int min;
int temp=0;
for(int i=0;i<n;i++)
{
a[i]=sc.nextInt();
}

for(int i=0;i<n-1;i++)
{
min=i;
for(int j=i+1;j<n;j++)
{
if(a[j]<a[min])
{
min=j;
}
}
temp=a[i];
a[i]=a[min];
a[min]=temp;

}
for(int i=0;i<n;i++)
{
System.out.print(a[i]+" ");
}
System.out.println("enter the Kth smallest element to be searched:");
int s=sc.nextInt();
System.out.print(a[s-1]+" ");

int l=a.length;

System.out.println("enter the Sth smallest element to be searched:");
int k=sc.nextInt();

System.out.println(a[l-k]);
}

}

• VIVEK KUMAR

#Python
arr=[7, 10, 4, 3, 20, 15]
num=int(input(“Enter the number”))
arr.sort(reverse=True)
print(arr[num-1])

• Technophilic

# python code-

ar=[7, 10, 4, 3, 20, 15]
k=int(input())
x=sorted(ar)
print(x[k-1])