Skip to content

Bug Report for anagram-groups #4427

@soorMSWE

Description

@soorMSWE

Bug Report for https://neetcode.io/problems/anagram-groups

Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.

def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
anaGroups = collections.defaultdict(list)

    for i in strs:
        count = [0] * 26
        for c in i:
            count[ord(c) - ord('a')] += 1
        anaGroups[tuple(count)].append(i)
    
    return anaGroups.values()

the above has been my solution for a while now, and I last used this on April 20, 2025. I did the problem again on July 28, 2025, and it did not accept this solution as the return type was not correct. I needed to cast anaGroups.values() to a list in order for it to be accepted. I'm not sure if this is actually a bug or not, but I thought I'd let you know as it stumped me for a few minutes.

Thank you for creating neetcode, I really appreciate everything you've done to help all of us aspiring software engineers out.🫡

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions