Two arrays of integers are given, each already sorted in non-decreasing order. Print the array obtained by merging the two arrays so that the result is also sorted in non-decreasing order.
The required algorithm is the two-pointer merge: compare the current elements of the two arrays and place the smaller one into the result, advancing the corresponding index.