public class Solution {
/*
* @param A: sorted integer array A which has m elements, but size of A is m+n
* @param m: An integer
* @param B: sorted integer array B which has n elements
* @param n: An integer
* @return: nothing
*/
public void mergeSortedArray(int[] A, int m, int[] B, int n) {
// write your code here
int index = m + n - 1;
m--;
n--;
while(n >= 0) {
if(m >= 0 && A[m] > B[n]) {
A[index] = A[m];
m--;
} else {
A[index] = B[n];
n--;
}
index--;
}
}
}