Given 2 sorted lists of length \(m\) and \(n\) where all elements of the 2 lists are different. Given a value \(k\), find the \(k\)-th smallest element of the union of the 2 lists.

Design and implement an algorithm for the problem. The time-complexity of your algorithm should be \(O(\log m + \log n)\).

Assignment

Write a Python function findKthSmallest(k:int,seq1:list,seq2:list) that returns the k-th smallest element of the union of seq1 and seq2.

Example

>>> findKthSmallest(7,[1,2,4,6,8,9,10,11,12,15,16,18,19],[3,5,7,13,14,17,20,21,22,23,24,25])
7
>>> findKthSmallest(8,[1,2,4,6,8,9,10,11,12,15,16,18,19],[3,5,7,13,14,17,20,21,22,23,24,25])
8
>>> findKthSmallest(1,[1,2,4,6,8,9,10,11,12,15,16,18,19],[3,5,7,13,14,17,20,21,22,23,24,25])
1
>>> findKthSmallest(2,[1,2,4,6,8,9,10,11,12,15,16,18,19],[3,5,7,13,14,17,20,21,22,23,24,25])
2
>>> findKthSmallest(25,[1,2,4,6,8,9,10,11,12,15,16,18,19],[3,5,7,13,14,17,20,21,22,23,24,25])
25
>>> findKthSmallest(24,[1,2,4,6,8,9,10,11,12,15,16,18,19],[3,5,7,13,14,17,20,21,22,23,24,25])
24
>>> findKthSmallest(23,[1,2,4,6,8,9,10,11,12,15,16,18,19],[3,5,7,13,14,17,20,21,22,23,24,25])
23
>>> findKthSmallest(19,[1,2,4,6,8,9,10,11,12,15,16,18,19],[3,5,7,13,14,17,20,21,22,23,24,25])
19
>>> findKthSmallest(5,[],[3,5,7,13,14,17,20,21,22,23,24,25])
14