C++ Solution || Brute Force || Hash Table
Approach : Brute Force\n Describe your approach to solving the problem. \n\n# Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\
# Approach : Brute Force\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    bool digitCount(string num) {\n        \n    vector<int> v(10,0);\n    for (int i = 0; i < num.size(); i++)\n        v[num[i] - \'0\']++;\n\n    for (int i = 0; i < num.size(); i++)\n        if (num[i] - \'0\' != v[i])\n           return false;\n\n    return true;\n\n    }\n};\n```\n# Approach : Hash Table\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    bool digitCount(string num) {\n        \n    unordered_map<int, int> m;\n    for (auto e : num)\n        m[e - \'0\']++;\n\n    for (int i = 0; i < num.size(); i++)\n        if (m[i] != num[i] - \'0\')\n            return false;\n    return true;\n\n    }\n};\n```
['C++']