Merge Sorted Array
void merge(int A[], int m, int B[], int n) { // Note: The Solution object is instantiated only once and is reused by each test case. int i = m-1; int j = n-1; int cur = m+n-1; while(i>=0&&j>=0) { if(A[i]>=B[j]) A[cur--] = A[i--]; else A[cur--] = B[j--]; } while(j>=0) A[cur--] = B[j--]; }