Merge two sorted arrays in place

0
Remix

Two integer arrays, arr1 and arr2, are each sorted in ascending order. Merge arr2 into arr1 without using another array, so that arr1 ends up holding all the values, still ascending. Follow-ups: what changes if both arrays are sorted in descending order, and what would you do if the arrays were not sorted at all?

AmazonTechnical phone screenLast asked Feb 2026
No answer yet. Write the first one; the best answer gets endorsed.