Skip to content

Commit 87bb8ea

Browse files
committed
solve: contains-duplicate
1 parent ee1ad8e commit 87bb8ea

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

contains-duplicate/crispy.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
#include <set>
3+
4+
class Solution {
5+
public:
6+
bool containsDuplicate(vector<int>& nums) {
7+
set<int> count;
8+
9+
for(int num : nums) {
10+
if (count.find(num) != count.end()) {
11+
return true;
12+
}
13+
count.insert(num);
14+
}
15+
16+
return false;
17+
}
18+
};

0 commit comments

Comments
 (0)