Skip to content

Commit 3feb455

Browse files
committed
contains duplicated solution
1 parent 0fc7ec8 commit 3feb455

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

contains-duplicate/dylan-jung.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public:
3+
bool containsDuplicate(vector<int>& nums) {
4+
unordered_set<int> s;
5+
for(auto item: nums) {
6+
if(s.count(item) > 0) return true;
7+
s.insert(item);
8+
}
9+
return false;
10+
}
11+
};
12+

0 commit comments

Comments
 (0)