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.
intgetTotalX(vector<int>a,vector<int>b){// assume vectors are sorted and a_n <= b_1 intbetweenCount=0;for(intq=a.back();q<=b.front();q+=a.back()){boolisMultiple=std::all_of(a.begin(),a.end(),[q](intel){returnq%el==0;});boolisFactor=std::all_of(b.begin(),b.end(),[q](intel){returnel%q==0;});if(isMultiple&&isFactor)betweenCount++;}returnbetweenCount;}
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 →