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 hereletmaxValue=Math.max(...a);letminValue=Math.min(...b);leti=2;letelements=[];letelement=maxValue;while(element<=minValue){letfactors=a.filter(num=>element%num==0);if(factors.length==a.length){letisFactor=b.filter(num1=>num1%element==0);if(isFactor.length==b.length){elements.push(element);}}element=maxValue*i;i++;}returnelements.length;}
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 Code: