class Solution {
public boolean digitCount(String num) {
int[] a = new int[10];
char[] chars = num.toCharArray();
int[] cnt = new int[10];
for (int i = 0; i < chars.length; i++) {
int b = chars[i] - '0';
cnt[b]++;
a[i] = b;
}
for (int i = 0; i < 10; i++) {
if (a[i]!=cnt[i]) return false;
}
return true;
}
}
标签:10,cnt,int,chars,2283,++,计数,数位
From: https://www.cnblogs.com/eiffelzero/p/17042710.html