Given two sorted integer arrays nums1 and nums2, merge them into a single sorted array and return it.
Both input arrays are sorted in non-decreasing order. The result should also be sorted in non-decreasing order.
For example, merging [1, 3, 5] and [2, 4, 6] produces [1, 2, 3, 4, 5, 6].
nums1 = [1, 3, 5], nums2 = [2, 4, 6][1, 2, 3, 4, 5, 6]nums1 = [1, 2, 3], nums2 = [4, 5, 6][1, 2, 3, 4, 5, 6]nums1 = [], nums2 = [1, 2, 3][1, 2, 3]0 <= nums1.length, nums2.length <= 10^4-10^9 <= nums1[i], nums2[i] <= 10^9Both arrays are sorted in non-decreasing order.Run your code to see results
Use Cmd+Enter to run