<p>You are given a <strong>0-indexed</strong> array of <code>n</code> integers <code>arr</code>.</p>
<p>The <strong>interval</strong> between two elements in <code>arr</code> is defined as the <strong>absolute difference</strong> between their indices. More formally, the <strong>interval</strong> between <code>arr[i]</code> and <code>arr[j]</code> is <code>|i - j|</code>.</p>
<p>Return <em>an array</em><code>intervals</code><em>of length</em><code>n</code><em>where</em><code>intervals[i]</code><em>is <strong>the sum of intervals</strong> between </em><code>arr[i]</code><em> and each element in </em><code>arr</code><em> with the same value as </em><code>arr[i]</code><em>.</em></p>
<p><strong>Note:</strong><code>|x|</code> is the absolute value of <code>x</code>.</p>