Loading...
Loading...
Loading...
Two binary search trees hold prices. Print all keys of both trees in increasing order, separated by spaces. A key that is in both trees is printed twice.
Example 1
Input
2 1 3 5 4 6
Output
1 2 3 4 5 6
Example 2
Input
# 7
Output
7
Try the problem first. Open one hint at a time.
Each inorder walk is already sorted.
heapq.merge combines sorted streams without sorting again.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor