auto commit
This commit is contained in:
parent
01f9a926dc
commit
f6c2333822
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user