Skip to content

Commit aa47fcc

Browse files
committed
solved Contains Duplicate
1 parent 29dc019 commit aa47fcc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

contains-duplicate/wclee2265.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// https://leetcode.com/problems/contains-duplicate/
2+
3+
class Solution {
4+
public:
5+
bool containsDuplicate(vector<int>& nums) {
6+
unordered_map<int, bool> hm;
7+
for(int x : nums) {
8+
if(hm[x]) return true;
9+
hm[x] = true;
10+
}
11+
return false;
12+
}
13+
};

0 commit comments

Comments
 (0)