Intervals Between Identical Elements at TuSimple

Medium45.5% acceptance

This problem has 100.0% frequency at TuSimple.

Problem Description

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` _wher...

Read full problem and hints

Topics

Also asked at 1 company


More TuSimple Questions

View all TuSimple questions