Files
LeetCode-Go/leetcode/0389.Find-the-Difference/389. Find the Difference.go
2020-08-07 17:06:53 +08:00

11 lines
168 B
Go

package leetcode
func findTheDifference(s string, t string) byte {
n, ch := len(t), t[len(t)-1]
for i := 0; i < n-1; i++ {
ch ^= s[i]
ch ^= t[i]
}
return ch
}