Kth Smallest Quickselect

Python Medium 4 views
Back to Questions

Problem Description

Read n integers and k (1-based). Compute kth smallest element using quickselect style and output it.

Input Format

First line n k. Second line n integers.

Output Format

One integer kth.

Sample Test Case

Input:
6 3 7 10 4 3 20 15
Output:
7

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next