/** * * @param A int整型一维数组 * @param B int整型一维数组 * @return void */ function merge( A, m, B, n ) { // write code here let indexA = m-1; let indexB = n-1; let index = m+n-1; while(indexA>=0&&indexB>=0){ const a = A[indexA]; const b = B[indexB]; if(a>b){ A[index] = a; indexA--; index--; continue; }else{ A[index] = b; indexB--; index--; continue; } } while(indexB>=0){ A[index] = B[indexB]; index--; indexB--; } return A; } module.exports = { merge : merge };