Find duplicate number on a given integer array in Golang
/*** Here we can create a map where key will be provided items in array and value will be the occurrence **/ package mainimport ( “fmt”)func main() { a := []int{1,2, 3, 5, 6,6,5,5} myMap := make(map[int]int) for _, val:= range a{ if _, ok := myMap[val]; ok { myMap[val] = myMap[val] +1 continue } […]
Continue Reading