88. Merge Sorted Array

Practice Merge Sorted Array for free on NudgeCode: Easy, Two Pointers pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

nums1 and nums2 are sorted in non-decreasing order. The first m slots of nums1 hold its values and the last n slots are 0 placeholders; nums2 holds n values.

Merge nums2 into nums1 in place so that nums1 becomes one sorted array of length m + n. Don't return anything.

Example

nums1 = [1,4,7,0,0,0], m = 3, nums2 = [2,5,6], n = 3  ->  [1,2,4,5,6,7]

Constraints