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.
// Complete the countTriplets function below.longcountTriplets(vector<long>arr,longr){longcount=0;map<long,long>m1;map<long,long>m2;for(constauto&e:arr){count+=m2[e];m2[e*r]+=m1[e];++m1[e*r];}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 →
More simple solution.