https://leetcode.com/problems/merge-sorted-array/ this is a link to the original problem. The issue I am having is when dealing with m=0 I was expecting to return the other array since the first array has no useful numbers I thought the answer would just be the second array
var merge = function (nums1, m, nums2, n) {
let outptr = nums1.length - 1;
let mptr = m - 1;
let nptr = Math.max(n - 1, 0);
if (m == 0) return nums2;
if (n == 0) return nums1;
while (!(mptr < 0 && nptr < 0)) {
//console.log(nums1)
if (mptr < 0) nums1[outptr] = nums2[nptr--];
else if (nptr < 0) nums1[outptr] = nums1[mptr--];
else if (nums1[mptr] > nums2[nptr])
nums1[outptr] = nums1[mptr--];
else
nums1[outptr] = nums2[nptr--];
outptr--;
}
return nums1;
}
``` on case 3 which is [[0], 0, [1], 1]; I am not passing the test but I thought that ```js
if (m == 0) return nums2;
``` would have taken care of that