88 Merge Sorted Array
1. Question
Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.
Note: You may assume thatnums1has enough space (size that is greater or equal tom+n) to hold additional elements fromnums2. The number of elements initialized in nums1 and nums2 are m and n respectively.
2. Implementation
(1) Two Pointers
3. Time & Space Complexity
时间复杂度O(m + n), m为nums1的长度,n为nums2的长度,空间复杂度O(1)
Last updated