Skip to content

Commit

Permalink
added All Characters Equal Number Occurrence probl
Browse files Browse the repository at this point in the history
  • Loading branch information
mukul96 authored Nov 30, 2022
1 parent 6da281a commit 75bafc2
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class Solution {
public:
bool areOccurrencesEqual(string s) {
unordered_map<char, int> mp;
int count = 0;
for(int i=0;i<s.length();i++){
mp[s[i]]+=1;
count = mp[s[i]];
}

for(auto it = mp.begin();it!=mp.end();++it){
if(count!=(it->second)){
return false;
}
}
return true;
}
};

0 comments on commit 75bafc2

Please sign in to comment.