beats 98.60% in time
Intuition\n Describe your first thoughts on how to solve this problem. \n- convert to char array using toCharArray();\n- to convert char to int -> num[i]-\'0\'\
#### Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n- convert to char array using `toCharArray()`;\n- to convert char to int -> `num[i]-\'0\'`\n- can use the opp. approach,  *i.e* int to char -> `num[i]+\'0\'`\n#### Approach\n<!-- Describe your approach to solving the problem. -->\nloop through the char array\nanother loop to count the frequency of each char `num[j] == i`\nif `num[i] == freq` return true\nreturn false when loop finishes.\n##### Code\n```\nclass Solution {\n    public boolean digitCount(String num) {\n        char[] numx = num.toCharArray();\n        int freq = 0;\n        for(int i=0; i<numx.length; i++){\n            freq = 0;\n            for(int j=0; j<numx.length; j++){\n                if(i == (numx[j]-\'0\')){\n                    freq++;\n                }\n            }\n            if((numx[i]-\'0\') != freq) return false;\n        }\n        return true;\n    }\n}\n```
['Java']