You are given two digit arrays, nums1 and nums2, representing two separate numerical sequences.
Your task is to form the largest possible sequence of length k, using digits taken from both arrays while preserving the original ordering of digits within each array.
You may choose any number of digits from either array as long as the final sequence length is exactly k and ordering constraints are maintained.
Return the resulting sequence as an array.
Input: nums1 = [5, 1, 9], nums2 = [8, 3, 7], k = 4
Output: [9, 8, 7, 3]
Input: nums1 = [1, 7, 5], nums2 = [6, 2, 8], k = 5
Output: [8, 7, 6, 5, 2]
Input: nums1 = [2, 6, 4], nums2 = [5, 9], k = 3
Output: [9, 6, 4]
Accepted:
Submission: