This problem is *super* broken


From the trivial cases to the actual submission, there is no consistent application of the rules in the description. Some cases include single index ‘groups’ while some ignore them. According to the problem statement a group must have at least two items (since any string is an anagram of itself, obviously). So clearly the answers with singleton lists in the answer are wrong. It would be stupid to consider the singletons, and it seems like this was a sloppily missed vestigial remnant of code returning some initialized values for the indices without filtering which ones actually turned into groups.

Or alternately, if for some strange reason we should include all singletons (which wouldn’t make any sense), still the answers do not apply this consistently – when including them, other test cases mismatch the expected output.

Can you please fix this? Looking at the comments, people have been complaining that it is broken for a long time, yet it is still included in the ‘Interview Practice Kit’ many people come here mainly for.


Agreed, the test cases are some of the worst I’ve seen on this platform. Especially the case of singleton lists.