You are viewing a single comment's thread. Return to all comments →
I used the same logic but it failed on 6th test case. Can you please tell me where is the problem?
long int n=arr.size(),count=0;
unordered_map<long int ,long int> mp1,mp2; for(long int i=0;i<n;i++){ if(mp2[arr[i]/r]!=0){ count+=mp2[arr[i]/r]; } if(mp1[arr[i]/r]!=0) mp2[arr[i]]+=mp1[arr[i]/r]; mp1[arr[i]]++; } return count;
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 →
I used the same logic but it failed on 6th test case. Can you please tell me where is the problem?
long int n=arr.size(),count=0;