Skip to content

Commit 1a00ff9

Browse files
author
easyone
committed
Feat: Add solution of contains-duplicate
1 parent b8b7c86 commit 1a00ff9

File tree

1 file changed

+10
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)