Skip to content

Commit 25ad7df

Browse files
committed
contains-duplicate solved
1 parent f291ae8 commit 25ad7df

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

contains-duplicate/kut7728.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/// Time, Space Complexity O(N)
2+
3+
class Solution {
4+
func containsDuplicate(_ nums: [Int]) -> Bool {
5+
var seen = Set<Int>()
6+
for num in nums {
7+
if seen.contains(num) {
8+
return true
9+
}
10+
seen.insert(num)
11+
}
12+
return false
13+
}
14+
}

0 commit comments

Comments
 (0)