Given two sorted arrays, how would you merge them into a single sorted array efficiently?
Implement merge_sorted_arrays(nums1, nums2), returning a new array containing all values from both inputs in nondecreasing order. Use the two-pointer approach, preserve duplicate values, and do not modify either input array.
def merge_sorted_arrays(nums1, nums2):