We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
functiongetTotalX(a,b){// Write your code hereletcount=0;letmin_a=Math.min(...a);for(leti=min_a;i<=Math.max(...b);i+=min_a){if(b.every((item)=>item%i===0)){if(a.every((item)=>i%item===0)){count+=1;}}}returncount;}
Cookie support is required to access HackerRank
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 solution