diff --git a/leetcode/leetcode75/1207.UniqueNumberOfOccurrences/uniqueNumberOfOccurrences.go b/leetcode/leetcode75/1207.UniqueNumberOfOccurrences/uniqueNumberOfOccurrences.go new file mode 100644 index 0000000..c7fb294 --- /dev/null +++ b/leetcode/leetcode75/1207.UniqueNumberOfOccurrences/uniqueNumberOfOccurrences.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" +) + +func uniqueOccurrences(arr []int) bool { + cnt := map[int]int{} + for _, x := range arr { + cnt[x]++ + } + vis := map[int]bool{} + for _, v := range cnt { + if vis[v] { + return false + } + vis[v] = true + } + return true +} + +func main() { + arr := []int{1, 2, 2, 1, 1, 3} + fmt.Println(uniqueOccurrences(arr)) +}