Skip to content

Commit

Permalink
go solution for 217 contains duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
Damans227 committed Jul 18, 2022
1 parent 5ec20a7 commit 7e394b7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions go/217-Contains-Duplicate.go
Original file line number Diff line number Diff line change
@@ -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

}

0 comments on commit 7e394b7

Please sign in to comment.