添加 problem 125

This commit is contained in:
YDZ
2018-04-15 16:40:00 +08:00
parent 8e05796f37
commit b482534fe2
6 changed files with 113 additions and 2 deletions

View File

@@ -5,4 +5,10 @@
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.
Note:
You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional elements from nums2. The number of elements initialized in nums1 and nums2 are m and n respectively.
You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional elements from nums2. The number of elements initialized in nums1 and nums2 are m and n respectively.
## 题目大意
合并两个已经有序的数组,结果放在第一个数组中,第一个数组假设空间足够大。要求算法时间复杂度足够低。
为了不大量移动元素就要从2个数组长度之和的最后一个位置开始依次选取两个数组中大的数从第一个数组的尾巴开始往头放只要循环一次以后就生成了合并以后的数组了。