Skip to content

Commit 535c242

Browse files
committed
Time: 7 ms (7.25%), Space: 15 MB (10.05%) - LeetHub
1 parent a3122ce commit 535c242

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
public:
3+
bool checkIfExist(vector<int>& arr) {
4+
map<int, int> mp;
5+
for (auto& i : arr) {
6+
mp[i]++;
7+
}
8+
for (auto& i : arr) {
9+
if (i == 0) {
10+
if (mp[0] > 1) return true;
11+
} else if(mp.find(i * 2) != mp.end()) return true;
12+
}
13+
return false;
14+
}
15+
};

0 commit comments

Comments
 (0)