Skip to content

Commit 96ab933

Browse files
authored
valid anagram solution
1 parent 4310183 commit 96ab933

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

valid-anagram/yhkee0404.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
func isAnagram(s string, t string) bool {
2+
sRune := []rune(s)
3+
tRune := []rune(t)
4+
sort.Slice(sRune, func(i, j int) bool {
5+
return sRune[i] < sRune[j]
6+
})
7+
sort.Slice(tRune, func(i, j int) bool {
8+
return tRune[i] < tRune[j]
9+
})
10+
return string(sRune) == string(tRune)
11+
}

0 commit comments

Comments
 (0)