✨🔥💫Here it's my 9 Languages💯Faster ☠ Easy 🧠W/Explanation with Images Beats 100☠🎉🎊✅✅✅
Intuition\n\n\n\n\n\n\njavascript []\n/**\n * @param {string} num\n * @return {boolean}\n */\nvar digitCount = function (num) {\n    const arr = Array(num.lengt
# Intuition\n![Screenshot 2024-02-27 110756.png](https://assets.leetcode.com/users/images/3dd3bc19-f6a1-40f3-ad13-e6924d5a38ba_1709013445.3136506.png)\n![Screenshot 2024-02-27 110854.png](https://assets.leetcode.com/users/images/ae67c29e-b033-4ce2-b1c7-65ae07b195d1_1709013451.746271.png)\n![Screenshot 2024-02-27 110941.png](https://assets.leetcode.com/users/images/d7c758d4-ac87-4132-a8a5-b83b8343f514_1709013456.5429547.png)\n![Screenshot 2024-02-27 111021.png](https://assets.leetcode.com/users/images/6d751bbb-3238-4791-80eb-f834739af39b_1709013462.095549.png)\n![Screenshot 2024-02-27 121041.png](https://assets.leetcode.com/users/images/23077522-5665-4c12-ae25-604e8f83594f_1709016065.597602.png)\n\n```javascript []\n/**\n * @param {string} num\n * @return {boolean}\n */\nvar digitCount = function (num) {\n    const arr = Array(num.length).fill(0)\n    for (let elem of num) {\n        arr[elem]++\n    }\n    return arr.join(\'\') == num\n};\n```\n```C []\nbool digitCount(char* num) {\n    int arr[10] = {};\n    for (int i = 0; num[i] != \'\\0\'; i++)\n        arr[num[i] - \'0\']++;\n    for (int i = 0; i < strlen(num); ++i) {\n        int x = num[i] - \'0\';\n        if (arr[i] == x)\n            continue;\n        else\n            return false;\n    }\n    return true;\n}\n```\n```python3 []\nclass Solution:\n    def digitCount(self, num: str) -> bool:\n        for i in range(len(num)):\n            if int(num[i]) != num.count(str(i)):\n                return False\n        return True\n```\n```C++ []\nclass Solution {\npublic:\n    bool digitCount(string num) {\n        unordered_map<int, int> mp;\n        for (auto& x : num)\n            mp[x - \'0\']++;\n        for (int i = 0; i < num.length(); ++i) {\n            if (mp[i] == num.at(i) - \'0\')\n                continue;\n            else\n                return false;\n        }\n        return true;\n    }\n};\n```\n```Typescript []\nfunction digitCount(num: string): boolean {\n    const arr = Array(num.length).fill(0);\n    for (const char of num)\n        arr[Number(char)]++;\n    \n    return arr.join(\'\') === num;\n};\n```\n```python []\nclass Solution(object):\n    def digitCount(self, num):\n        """\n        :type num: str\n        :rtype: bool\n        """\n        list = [0] * 10\n        for n in num:\n            list[int(n)] += 1\n        \n        for i in range(0, len(num)):\n            if list[i] == int(num[i]):\n                continue\n            else:\n                return False\n        return True\n\n\n        \n```\n```Java []\nclass Solution {\n    public boolean digitCount(String num) {\n        int[] hash = new int[10];\n        for (int i = 0; i < num.length(); i++)\n            hash[num.charAt(i) - \'0\']++;\n        for (int i = 0; i < num.length(); ++i) {\n            if (hash[i] == num.charAt(i) - \'0\')\n                continue;\n            else\n                return false;\n        }\n        return true;\n    }\n}\n```\n``` C# []\npublic class Solution {\n    public bool DigitCount(string num) {\n        int []arr = new int[10];\n        for (int i = 0; i < num.Length; i++)\n            arr[num[i] - \'0\']++;\n        for (int i = 0; i < num.Length; ++i) {\n            if (arr[i] == num[i] - \'0\')\n                continue;\n            else\n                return false;\n        }\n        return true;\n    }\n}\n```\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n     O(n) --> n = string length\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n     O(26) --> O(1)\n# Code\n```\n/**\n * @param {string} num\n * @return {boolean}\n */\nvar digitCount = function (num) {\n    const arr = Array(num.length).fill(0)\n    for (let elem of num) {\n        arr[elem]++\n    }\n    return arr.join(\'\') == num\n};\n```\n# It\'s very easy and usefl solution for all of you to understand .. so please upvote\n![th.jpeg](https://assets.leetcode.com/users/images/dedee7d2-6462-487b-a1d8-d6da80b19257_1709013818.618187.jpeg)\n
['Hash Table', 'Ordered Map', 'C', 'Python', 'C++', 'Java', 'TypeScript', 'Python3', 'JavaScript', 'C#']