题解 | #合并两个有序的数组#
合并两个有序的数组
http://www.nowcoder.com/practice/89865d4375634fc484f3a24b7fe65665
/**
*
* @param A int整型一维数组
* @param B int整型一维数组
* @return void
*/
function merge( A, m, B, n ) {
// write code here
// A.push(1)
A.splice(m)
A.push(...B)
// B.slice(0)
// A.push(...B)
A.sort((a,b)=>a-b)
return A
}
module.exports = {
merge : merge
};
查看16道真题和解析