牛人代码;
思路很新颖;
class Solution {
public:
/**
* @param A: sorted integer array A which has m elements,
* but size of A is m+n
* @param B: sorted integer array B which has n elements
* @return: void
*/
void mergeSortedArray(int A[], int m, int B[], int n) {
// write your code here
int i=m+n-1;
int j=m-1;
int k=n-1;
while(j>=0&&k>=0){
if(A[j]>B[k])
A[i--]=A[j--];
else
A[i--]=B[k--];
}
while(j>=0)
A[i--]=A[j--];
while(k>=0)
A[i--]=B[k--];
}
};