📌  相关文章
📜  javascript代码示例中的两组hackerrank解决方案之间

📅  最后修改于: 2022-03-11 15:01:14             🧑  作者: Mango

代码示例1
// Between Two Sets hackerrank solution in javascript
function getTotalX(a, b) {
    // Write your code here
    let result = 0;
    let RemoveArrayA = a.splice(1, a.length); // remove elements from array a but not a[0]

    for(let i = 1; a[0] * i <= b[0]; i++){
        if(RemoveArrayA.every(item => (a[0] * i) % item === 0) && b.every(item => item % (a[0] * i) === 0)){
            result++
        }
    }
    return result;
}