javascript counter 105ms
\nconst counter = (a_or_s) => { let m = new Map(); for (const x of a_or_s) m.set(x, m.get(x) + 1 || 1); return m; };\n\nconst digitCount = (a) => {\n    let m =
```\nconst counter = (a_or_s) => { let m = new Map(); for (const x of a_or_s) m.set(x, m.get(x) + 1 || 1); return m; };\n\nconst digitCount = (a) => {\n    let m = counter(a), n = a.length;\n    for (let i = 0; i < n; i++) {\n        let cnt = m.get(i + \'\') || 0\n        if (a[i] != cnt) return false;\n    }\n    return true;\n};\n```
['JavaScript']