Skip to content

Commit 75bafc2

Browse files
authored
added All Characters Equal Number Occurrence probl
1 parent 6da281a commit 75bafc2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class Solution {
2+
public:
3+
bool areOccurrencesEqual(string s) {
4+
unordered_map<char, int> mp;
5+
int count = 0;
6+
for(int i=0;i<s.length();i++){
7+
mp[s[i]]+=1;
8+
count = mp[s[i]];
9+
}
10+
11+
for(auto it = mp.begin();it!=mp.end();++it){
12+
if(count!=(it->second)){
13+
return false;
14+
}
15+
}
16+
return true;
17+
}
18+
};

0 commit comments

Comments
 (0)