mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-23 18:10:20 +08:00
17 lines
257 B
Go
17 lines
257 B
Go
package leetcode
|
|
|
|
func uniqueOccurrences(arr []int) bool {
|
|
freq, m := map[int]int{}, map[int]bool{}
|
|
for _, v := range arr {
|
|
freq[v]++
|
|
}
|
|
for _, v := range freq {
|
|
if _, ok := m[v]; !ok {
|
|
m[v] = true
|
|
} else {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|