Loading...
Loading...
Loading...
A binary search tree holds item prices. Print the kth smallest price.
Example 1
Input
8 3 10 1 6 # 14 # # 4 7 13 3
Output
4
Example 2
Input
2 1 3 1
Output
1
Try the problem first. Open one hint at a time.
Inorder lists keys in increasing order.
itertools.islice can skip k - 1 keys from a generator.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor