Skip to content

Commit

Permalink
update sol
Browse files Browse the repository at this point in the history
  • Loading branch information
ductnn committed Nov 29, 2023
1 parent 759357b commit 0219b7e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions leetcode/217.ContainsDuplicate/ContainsDuplicate.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ func containsDuplicate(nums []int) bool {
return false
}

func containsDuplicate1(nums []int) bool {
m := map[int]bool{}

for _, n := range nums {
if m[n] {
return true
}
m[n] = true
}

return false
}

func main() {
nums := []int{8, 5, 2, 9, 10, 6, 3, 3}

Expand Down

0 comments on commit 0219b7e

Please sign in to comment.