Problem 2121 · Medium

Intervals Between Identical Elements

For each position, sum its distances to positions with the same value.

Open the interactive visualisation