Hello everyone , My name is Qi Guanjie （qí guān jié ）, stay GitHub & CSDN Record the process of learning , Time flies , Future period , come on. ~ Bloggers are only in GitHub & CSDN Chinese blog , The only blog update address is ： Qi Guanjie's blog , In the near future, we will gradually synchronize the relevant records to GitHub：[Algorithmic-learning-records] (https://github.com/qiguanjie/Algorithmic-learning-records), Most of them are my records , If reprinted, please attach the original address , thank you .
Due to the need of study and work , Algorithm brush problem will gradually change from C++ towards Python3 excessive , In transition , If the implementation is not very beautiful , Please forgive me .
This article was originally written by Qi Guanjie , Please support the original , Some platforms have been stealing blog articles maliciously ！！！
If you need to contact the blogger , You can contact me on wechat ：qiguanjie2015
Here are two arrays of ordered integers
nums2, Would you please
nums2 Merge into
nums1 in *,* send
nums1 Make an ordered array .
nums2 The number of elements of is
n . You can assume
nums1 The size of the space is equal to
m + n, So that it has enough space to hold from
nums2 The elements of .
Input ：nums1 = [1,2,3,0,0,0], m = 3, nums2 = [2,5,6], n = 3 Output ：[1,2,2,3,5,6]
Input ：nums1 = , m = 1, nums2 = , n = 0 Output ：
nums1.length == m + n
nums2.length == n
0 <= m, n <= 200
1 <= m + n <= 200
-109 <= nums1[i], nums2[i] <= 109
class Solution: def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """ Do not return anything, modify nums1 in-place instead. """ nums1[m:] = nums2 nums1.sort()