diff --git a/go/217-Contains-Duplicate.go b/go/217-Contains-Duplicate.go new file mode 100644 index 000000000..280d3b8d8 --- /dev/null +++ b/go/217-Contains-Duplicate.go @@ -0,0 +1,12 @@ +func containsDuplicate(nums []int) bool { + nums_map := map[int]int{} + for _, n := range nums { + if _, ok := nums_map[n]; !ok { + nums_map[n] = 1 + } else { + return true + } + } + return false + +} \ No newline at end of file