You are given two sorted collections of numbers, coll1 and coll2, and an integer k, find the k-th smallest element in the conceptual combined sorted collection.
Note that k is 1-based, meaning k=1 refers to the smallest element. You should not merge the two collections to solve this problem.
coll1 = [1, 3, 5]
coll2 = [2, 4, 6]
k = 4
4
The combined sorted collection would be [1, 2, 3, 4, 5, 6]. The 4th element is 4.
coll1 = [10, 20]
coll2 = [100, 200, 300]
k = 3
100
The combined sorted collection would be [10, 20, 100, 200, 300]. The 3rd element is 100.
coll1 = [5]
coll2 = [1, 2, 3, 4]
k = 5
5
The combined sorted collection would be [1, 2, 3, 4, 5]. The 5th element is 5.
coll1 = [1, 3, 5]
coll2 = [2, 4, 6]
k = 4
4