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.
Hello. I can suggest such principle;
count the number of dublicate anagram substrings and than sum the numbers of k[n]; where k[n] denotes the number of pairs from n dublicates; k[0]=0; and k[n]=k[n-1]+n-1;
you are using maybe the similar method but can you tell me what method u are using for counting duplicates? i only get all substrings and sort characters in it and than used map for counting duplicates.
Sherlock and Anagrams
You are viewing a single comment's thread. Return to all comments →
Hello. I can suggest such principle; count the number of dublicate anagram substrings and than sum the numbers of k[n]; where k[n] denotes the number of pairs from n dublicates; k[0]=0; and k[n]=k[n-1]+n-1; you are using maybe the similar method but can you tell me what method u are using for counting duplicates? i only get all substrings and sort characters in it and than used map for counting duplicates.
here is code: http://ideone.com/EXeL2V