1 package zenith 2 3 func uniqueInts(s []int) []int { 4 seen := make(map[int]struct{}, len(s)) 5 j := 0 6 for _, v := range s { 7 if _, ok := seen[v]; ok { 8 continue 9 } 10 seen[v] = struct{}{} 11 s[j] = v 12 j++ 13 } 14 return s[:j] 15 } 16
View as plain text