📅  最后修改于: 2022-03-11 15:01:14             🧑  作者: Mango
// 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;
}