Leetcode Note: Go - Unique Number of Occurrences
Unique Number of Occurrences - LeetCode
https://leetcode.com/problems/unique-number-of-occurrences/
- Go 言語で取り組んだメモ
回答
Unique Number of Occurrences - LeetCode
https://leetcode.com/problems/unique-number-of-occurrences/solution/
My Golang Solution - LeetCode Discuss
https://leetcode.com/problems/unique-number-of-occurrences/discuss/394475/My-Golang-Solution
func uniqueOccurrences(arr []int) bool {
var count = make(map[int]int)
for i:=0; i<len(arr); i++{
count[arr[i]]++
}
var result = make(map[int]int)
for _,value:=range count{
result[value]++
if result[value]!=1 {
return false
}
}
return true
}