public 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 idxA = m - 1;
    	int idxB = n - 1;
    	int idx = m + n - 1;
    	
    	while (idxA >= 0 && idxB >= 0)
    	{
    		if (A[idxA] > B[idxB])
    			A[idx--] = A[idxA--];
    		else
    			A[idx--] = B[idxB--];
    	}
    	
    	while (idxB >= 0)
			A[idx--] = B[idxB--];
    }