• + 0 comments

    You don't need max from B. You need min from B which is basically the first element of B array. Also you don't need to start from 0, you need to start from the max value from A array which is the last element of A. And finally you don't need to increment step by just 1. You need to increment by the max value from the A array.

    `function getTotalX(a, b) { // Write your code here let validNums = 0; let currNum = a[a.length - 1];

    for (let i = currNum; i <= b[0]; i += currNum) { if (a.every(el => i % el === 0)) { if (b.every(el => el % i === 0)) { validNums++; } } } return validNums; }