1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| // @Title: 找不同 (Find the Difference)
// @Author: 15816537946@163.com
// @Date: 2020-12-18 10:44:08
// @Runtime: 0 ms
// @Memory: 2.1 MB
func findTheDifference(s string, t string) byte {
var ret byte
if s == "" {
temp := []byte(t)
return temp[0]
}
for i := range t {
ret += t[i] - 'a'
}
for j := range s {
ret -= s[j] - 'a'
}
return byte(ret + 'a')
}
|