提交 f6c23338 编写于 作者: C CyC2018

auto commit

上级 01f9a926
...@@ -209,7 +209,7 @@ Output: [1,2,2,3,5,6] ...@@ -209,7 +209,7 @@ Output: [1,2,2,3,5,6]
public void merge(int[] nums1, int m, int[] nums2, int n) { public void merge(int[] nums1, int m, int[] nums2, int n) {
int index1 = m - 1, index2 = n - 1; int index1 = m - 1, index2 = n - 1;
int indexMerge = m + n - 1; int indexMerge = m + n - 1;
while (index1 >= 0 || index2 >= 0) { while (index2 >= 0) {
if (index1 < 0) { if (index1 < 0) {
nums1[indexMerge--] = nums2[index2--]; nums1[indexMerge--] = nums2[index2--];
} else if (index2 < 0) { } else if (index2 < 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册