You are given two integer arrays nums1 and nums2, sorted in ascending order, and two integers m and n, representing the number of elements to be merged in nums1 and nums2 respectively.
Merge nums1 and nums2 into a single array sorted in ascending order.
The final sorted array should not be returned by the function, but instead be stored inside the array, nums1.
To accommodate this, nums1 has a length of m + n, where the first m elements denote the elements that should be merged, and the last n elements should be ignored.
Input: nums1 = [1,2,3,4,5,6], m = 3, nums2 = [2,5,6], n = 3
Output: [1,2,2,3,5,6]
Explanation: The arrays we are merging are [1,2,3] and [2,5,6].
The result of the merge is [1,2,2,3,5,6] with the underlined elements coming from nums1.
nums1.length == m + n
nums2.length >= n
0 <= m, n <= 200
1 <= m + n <= 200
-109 <= nums1[i], nums2[j] <= 109
1, 2, 3, 4, 5, 6
7, 8, 9
4
2
First line represents nums1.
Second line represents nums2.
Third line shows m, which represents first four elements from nums1 will be processed.
Fourth line shows n, which represents first two elements from nums2 will be processed.
[1, 2, 3, 4, 7, 8]
7, 8, 9, 10, 11, 12
1, 2, 3, 4
4
2
[1, 2, 7, 8, 9, 10]