Count Duplicate Elements — JavaScript easy interview problem
Given an array `arr`, return how many **distinct** values appear more than once. Example: `countDuplicates([1,2,2,3,3,3,4])` → `2` (values 2 and 3).
Tags: hashmap, set
Practice this HashMap & Set problem free in the JS Interview Playground with automated tests and unlockable solutions.