Merge Sorted Array
Problem
- Merge nums1 and nums2 into a single array sorted in non-decreasing order.
Approach
- 1. Append the two arrays together
- 2. Sort
Reflections
Cheated just so I could do a leetcode today. Will redo later
Go Solution
func merge(nums1 []int, m int, nums2 []int, n int) {
nums := nums1
for _, num := range nums2 {
nums[m] = num
m++
}
sort.Ints(nums)
nums1 = nums
}