Compare the len(nums1)/2th and len(nums2)/2th element, increase or decrease the position based on different situations. Very hard. Give up temporary. Time complexity is O(lg(min(m,n)))
Think about it as finding the kth element in two sorted array. Compare thek/2th element in nums1 and k/2th element in nums2, then throw k/2 element. This algorithm uses iteration with binary search. Its time complexity is O(lgk)