Very easy to understand. Beats 91.43%
Approach\nWe have only 10 digits, that\'s why it is not necessary use dictionary or other collections. It is not good approach. Counting number of digits to arr
# Approach\nWe have only 10 digits, that\'s why it is not necessary use dictionary or other collections. It is not good approach. Counting number of digits to array is convinient and easy to check for result at the end.\nBeats 91.43% of solutions in time, 68.57% of solutions in space complexity.\n\n# Complexity\n- Time complexity:\n$$O(n)$$\n\n- Space complexity:\n$$O(1)$$\n\n# Code\n```\npublic class Solution \n{\n    public bool DigitCount(string num)\n    {\n        int[] digits = new int[10];\n\n        for (int i = 0; i < num.Length; i++)\n        {\n            digits[num[i] - \'0\']++;\n        }\n\n        for (int i = 0; i < num.Length; i++)\n        {\n            if (digits[i] != num[i] - \'0\')\n            {\n                return false;\n            }\n        }\n\n        return true;\n    }\n}\n```
['C#']