Easiest Solution || 100% Beats🔥💯
IntuitionCounting occurs of each digit of given string.Approach
Make a frequency array counting number of occurence of each digit in given string
Iterate over s
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Counting occurs of each digit of given string.

# Approach
<!-- Describe your approach to solving the problem. -->
- Make a frequency array counting number of occurence of each digit in given string
- Iterate over string num and return false if number of occurence at a given index is not equal to the digit at the index of string
- If loop completes then return true;

# Complexity
- Time complexity:O(N)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public boolean digitCount(String num) {
        int freq[] = new int[10];
        for(char c : num.toCharArray()){
            freq[c-'0']++;
        }

        for(int i = 0 ; i<num.length(); i++){
            if(freq[i]!= num.charAt(i)-'0'){
                return false;
            }
        }
        return true;
        
    }
}
```
['Java']