Wrong answer for one of the test case


#1

Input : A : [ “abbbaabbbabbbbabababbbbbbbaabaaabbaaababbabbabbaababbbaaabbabaabbaabbabbbbbababbbababbbbaabababba”, “abaaabbbabaaabbbbabaabbabaaaababbbbabbbaaaabaababbbbaaaabbbaaaabaabbaaabbaabaaabbabbaaaababbabbaa”, “babbabbaaabbbbabaaaabaabaabbbabaabaaabbbbbbabbabababbbabaabaabbaabaabaabbaabbbabaabbbabaaaabbbbab”, “bbbabaaabaaaaabaabaaaaaaabbabaaaabbababbabbabbaabbabaaabaabbbabbaabaabaabaaaabbabbabaaababbaababb”, “abbbbbbbbbbbbabaabbbbabababaabaabbbababbabbabaaaabaabbabbaaabbaaaabbaabbbbbaaaabaaaaababababaabab”, “aabbbbaaabbaabbbbabbbbbaabbababbbbababbbabaabbbbbbababaaaabbbabaabbbbabbbababbbaaabbabaaaabaaaaba”, “abbaaababbbabbbbabababbbababbbaaaaabbbbbbaaaabbaaabbbbbbabbabbabbaabbbbaabaabbababbbaabbbaababbaa”, “aabaaabaaaaaabbbbaabbabaaaabbaababaaabbabbaaaaababaaabaabbbabbababaabababbaabaababbaabbabbbaaabbb” ]

Expected output :slight_smile:[1 ] [2 ] [3 5 ] [4 ] [6 ] [7 ] [8 ]
How come [1],[2],[4],[6],[7],[8] are there.


#2

One of the requirements not clear in this problem is how to handle strings that are not part of an anagram.

Ex: [“cat”, “dog”, “act”, “foo”, “bar”]
This should return [[1,3], [2], [4], [5]]
dog, foo, bar don’t have anagrams but are yet part of a group, a group with only themselves.


#3

Strings that don’t have anagrams are anagrams to themselves


#4

This testcase is result is correct.
You are not considering counts for duplicate values.
in the 3rd and 5th string for the input, no of a’s and b’s are also equal while for others it is not hence [3,5] is hashed together.

Please count the characters also for duplicacy.