public:
    void merge(int A[], int m, int B[], int n) {
        int end = m + n - 1;
        int ia = m - 1;
        int ib = n - 1;
        while(end != 0 && ia >= 0 && ib >= 0){
            if(A[ia] >= B[ib]){
                A[end--] = A[ia--];
            } else{
                A[end--] = B[ib--];
            }
        }
        while(ib>=0){
            A[end--] = B[ib--];
        }
        
    }
};
https://www.nowcoder.com/practice/89865d4375634fc484f3a24b7fe65665?tpId=295&tqId=658&ru=/exam/oj&qru=/ta/format-top101/question-ranking&sourceUrl=%2Fexam%2Foj%3Ftab%3D%25E7%25AE%2597%25E6%25B3%2595%25E7%25AF%2587%26topicId%3D295