classSolution:defmaxNumber(self,nums1: List[int],nums2: List[int],k:int) -> List[int]:defmax_numbers(nums,k_): stack = [] drops =len(nums)- k_for num in nums:while drops and stack and stack[-1]< num: stack.pop() drops -=1 stack.append(num)return stack[:k_]defmerge(a,b): stack = []while a or b: bigger = a if a > b else b stack.append(bigger[0]) bigger.pop(0)return stackreturnmax(merge(max_numbers(nums1, i), max_numbers(nums2, k - i)) for i inrange(k +1) if i <=len(nums1) and k - i <=len(nums2))