Check if All Characters Have Equal Number of Occurrences
查一个字符串是不是所有出现过的字符的字频都一样
class Solution {
public boolean areOccurrencesEqual(String s) {
int[] count = new int[26];
for(char c : s.toCharArray())
count[c - 'a']++;
Integer j = null;
for(int c : count)
if(c != 0){
if(j == null)
j = c;
else
if(c != j)
return false;
}
return true;
}
}