Skip to content

Commit 7170367

Browse files
committed
Add C++ solution of problem #2206
1 parent 39a1c39 commit 7170367

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

2206/solution.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class Solution {
2+
public:
3+
bool divideArray(vector<int>& A) {
4+
int n = A.size();
5+
if(n & 1)
6+
return false;
7+
8+
unordered_map<int, int> m;
9+
for(int a : A) {
10+
m[a]++;
11+
}
12+
for(auto [_, v] : m) {
13+
if(v & 1)
14+
return false;
15+
}
16+
return true;
17+
}
18+
};

0 commit comments

Comments
 (0)