Answers for "go count distinct elements in list"

Go
0

go count distinct elements in list

distinct := make(map[T]bool)
for _, v := range items {
	distinct[v] = true
}
cnt := len(distinct)
Posted by: Guest on March-09-2021

Code answers related to "go count distinct elements in list"

Browse Popular Code Answers by Language