Skip to content

Bug Report for is-anagram #4734

@zaldk

Description

@zaldk

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

I ran the following code but the cli gave this error:

# command-line-arguments
./main.go:-4:2: "reflect" imported and not used

^^^^^ i have no way to deal with that, as it is outside of my program.

func isAnagram(s string, t string) bool {
    if len(s) != len(t) { return false }
    store := make(map[rune]int)

    for _, char := range s {
        store[char] += 1
    }
    for _, char := range t {
        store[char] -= 1
    }

    for _, v := range store {
        if v != 0 { return false }
    }
    return true
}

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