https://leetcode.com/problems/check-if-all-characters-have-equal-number-of-occurrences/



Runtime: 89 ms, faster than 69.23% of TypeScript online submissions for Check if All Characters Have Equal Number of Occurrences.

Memory Usage: 45.2 MB, less than 57.69% of TypeScript online submissions for Check if All Characters Have Equal Number of Occurrences.



```typescript
function areOccurrencesEqual(s: string): boolean {
    //10:17
    const theMap = new Map()
    for (const char of s) {
        if (theMap.has(char)) {
            theMap.set(char, theMap.get(char) + 1)
        } else {
            theMap.set(char, 1)
        }
    }
    
    let sum = 0
    for (let value of theMap.values()) {
        sum += value
    }
    
    const a = (sum/theMap.size)
    for (let value of theMap.values()) {
        if (value != a) {
            return false
        }
    }
    
    return true
    //10:20
    //debug until 10:25
};
```
