CodeOath
← All problems

Find Duplicate Array Positions

Medium
arrayshash-table

Map each value appearing more than once to the list of index positions where it occurs.

Example:

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