mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-25 20:21:47 +08:00
规范格式
This commit is contained in:
@ -0,0 +1,18 @@
|
||||
package leetcode
|
||||
|
||||
import "strings"
|
||||
|
||||
func uncommonFromSentences(A string, B string) []string {
|
||||
m, res := map[string]int{}, []string{}
|
||||
for _, s := range []string{A, B} {
|
||||
for _, word := range strings.Split(s, " ") {
|
||||
m[word]++
|
||||
}
|
||||
}
|
||||
for key := range m {
|
||||
if m[key] == 1 {
|
||||
res = append(res, key)
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
Reference in New Issue
Block a user