Skip to content

Latest commit

 

History

History
15 lines (12 loc) · 225 Bytes

merge-sorted-array.md

File metadata and controls

15 lines (12 loc) · 225 Bytes

Code

func merge(nums1 []int, m int, nums2 []int, n int) {
	copy(nums1[m:], nums2)
	sort.Ints(nums1)
}

Solution in mind

  • Copy second array into empty positions of first.
  • Sort first array.