ICE market-data validation pipelines may receive a sorted sequence whose zero values are placeholders for missing observations. Given this sequence and a second sorted sequence, move every zero in the first sequence to its end, then merge its non-zero values with the second sequence.
The non-zero values in nums already appear in nondecreasing order when the zeros are ignored. The values in other are also sorted in nondecreasing order. Preserve the relative order of non-zero values while moving zeros. Return a new sorted list containing all non-zero values from both inputs, followed by all zeros originally present in nums.
Implement rearrange_and_merge(nums, other), where both inputs are lists of non-negative integers. Modify nums in place so its non-zero values occupy the prefix and its zeros occupy the suffix. Return the merged result as a new list.
def rearrange_and_merge(nums, other):