Skip to content

Commit d5c6168

Browse files
committed
contains duplicated solution
1 parent da4a5d5 commit d5c6168

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

contains-duplicate/youngDaLee.go

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

0 commit comments

Comments
 (0)