[LeetCode] Intervals Between Identical Elements

2121. Intervals Between Identical Elements

You are given a 0-indexed array of n integers arr.

The interval between two elements in arr is defined as the absolute difference between their indices. More formally, the interval between arr[i] and arr[j] is |i - j|.

Return an array intervals of length n where intervals[i] is the sum of intervals between arr[i] and each element in arr with the same value as arr[i].

Note: |x| is the absolute value of x.

Read more
[AtCoder] C - Linear ApproximationRead more
[AtCoder] D - Islands WarRead more
[AtCoder] C - Modulo SummationRead more
[AtCoder] D - AtCoder Express 2Read more
[AtCoder] C - To InfinityRead more
[Codeforces] Round #128 (Div. 2) C. PhotographerRead more
[Codeforces] Round #125 (Div. 1) B. Jumping on WallsRead more
[Codeforces] Round #124 (Div. 2) B. LimitRead more
[Codeforces] Round #129 (Div. 2) B. Little Elephant and SortingRead more