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.
My Solution. Now I need to understand the difference between these solutions.
// Complete the countTriplets function below.longcountTriplets(vector<long>arr,longr){longcount=0;map<long,long>m1;map<long,long>m2;for(constauto&e:arr){if(e%r==0){count+=m2[e/r];m2[e]+=m1[e/r];}++m1[e];}returncount;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Count Triplets
You are viewing a single comment's thread. Return to all comments →
My Solution. Now I need to understand the difference between these solutions.