Loading...
Loading...
Loading...
A shop keeps item prices in a binary search tree. Print the smallest and the largest price, separated by a space.
Example 1
Input
8 3 10 1 6 # 14 # # 4 7 13
Output
1 14
Example 2
Input
5
Output
5 5
A single node is both.
Try the problem first. Open one hint at a time.
The smallest key is where the left links end.
The largest key is where the right links end.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor