Skip to content

Commit

Permalink
2206
Browse files Browse the repository at this point in the history
  • Loading branch information
isinsuarici committed Dec 11, 2022
1 parent 1422793 commit 6897d8e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions E_2206_DivideArrayIntoEqualPairs.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class Solution {
public:
bool divideArray(vector<int>& nums) {
unordered_map<int,int> num_map;
for(int i=0; i<nums.size(); i++){
num_map[nums[i]]++;
}
int pairs=0;
for(auto el:num_map){
pairs+= el.second/2;
}
return pairs==nums.size()/2;
}
};

0 comments on commit 6897d8e

Please sign in to comment.