// Package q1207 implements a solution for https://leetcode.com/problems/unique-number-of-occurrences/ package q1207 import "slices" type void struct{} func uniqueOccurrences(arr []int) bool { slices.Sort(arr) seen := map[int]void{} for i := 0; i < len(arr); { c := arr[i] count := 0 for ; i < len(arr) && arr[i] == c; i++ { count++ } if _, ok := seen[count]; ok { return false } seen[count] = void{} } return true } var _ = uniqueOccurrences