← Questions

Merge two sorted arrays in place

0
AmazonCodingLast asked Feb 2026

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?

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding