CodeOath
← All problems

Count Duplicate Array Members

Medium
arrayshash-table

Map each value appearing more than once to its count.

Example:

Input: arr = [1, 2, 2, 3, 3, 3, 4]
Output: { 2: 2, 3: 3 }