Skip to content

Instantly share code, notes, and snippets.

@MorrisLaw
Last active July 5, 2022 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MorrisLaw/e3bbbf9469e9b66215932c75db09fe9c to your computer and use it in GitHub Desktop.
Save MorrisLaw/e3bbbf9469e9b66215932c75db09fe9c to your computer and use it in GitHub Desktop.
Valid Anagram - LeetCode 242
func isAnagram(s string, t string) bool {
sCount := make([]int, 26)
for _, char := range s {
sCount[char-'a']++
}
tCount := make([]int, 26)
for _, char := range t {
tCount[char-'a']++
}
return reflect.DeepEqual(sCount, tCount)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment