Skip to content

Unordered result should be accepted for 49. Group Anagrams #68

@arunsathiya

Description

@arunsathiya

for _, tt := range tests {
t.Run("groupAnagrams", func(t *testing.T) {
got := groupAnagrams(tt.strs)
for _, g := range got {
sort.Strings(g) // Sort to avoid mismatch due to different order
}
for _, w := range tt.want {
sort.Strings(w) // Sort to ensure the comparison works correctly
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("groupAnagrams(%v) = %v, want %v", tt.strs, got, tt.want)
}
})
}

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