You are viewing a single comment's thread. Return to all comments →
JavaScript
function getTotalX(a, b) { let start = Math.max(...a); let end = Math.min(...b); let count = 0; for (let i = start; i <= end; i++) { let aCheck = true; let bCheck = true; let aIndex = 0; let bIndex = 0; while (aCheck === true && aIndex < a.length) { if (i % a[aIndex] !== 0) { aCheck = false; } aIndex++; } while (bCheck === true && bIndex < b.length) { if (b[bIndex] % i !== 0) { bCheck = false; } bIndex++; } if (aCheck && bCheck) { count++; } } return count; }
Seems like cookies are disabled on this browser, please enable them to open this website
Between Two Sets
You are viewing a single comment's thread. Return to all comments →
JavaScript