Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ad3b09e

Browse files
authored
Merge pull request neetcode-gh#528 from Damans227/217-Contains-Duplicate
go solution for 217 contains duplicate
2 parents 5ec20a7 + 7e394b7 commit ad3b09e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

go/217-Contains-Duplicate.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
func containsDuplicate(nums []int) bool {
2+
nums_map := map[int]int{}
3+
for _, n := range nums {
4+
if _, ok := nums_map[n]; !ok {
5+
nums_map[n] = 1
6+
} else {
7+
return true
8+
}
9+
}
10+
return false
11+
12+
}

0 commit comments

Comments
 (0)