Skip to content

合并两个有序数组

LeetCode-88

js

var merge = function(nums1, m, nums2, n) {
  for (let i = m, j = 0; i < m + n; i++) {
    nums1[i] = nums2[j++]
  }
  nums1.sort((a, b) => a - b) // sort不太优雅... 抽空看看指针解法
}