https://leetcode-cn.com/problems/valid-anagram/
异或运算找重复值
func f(s string) int { n := len(s) var a int a = 1 for i := 0; i < n; i++ { a ^= int(rune(s[i])) } return a } func isAnagram(s string, t string) bool { return f(s)^f(t) == 0 }
原创文章,作者:kepupublish,如若转载,请注明出处:https://blog.ytso.com/245346.html