you give 0indexed array n integer arrthe interval element arr define absolute difference index more formally interval arri arrj jReturn array interval length n intervalsi sum intervals arri element arr value arriNote x absolute value x Example 1input arr 2131233output 4272445explanation Index 0 another 2 find index 4 0 4 4 index 1 another 1 find index 3 1 3 2 Index 2 two 3s find index 5 6 2 5 2 6 7 index 3 another 1 find index 1 3 1 2 index 4 another 2 find index 0 4 0 4 index 5 two 3s find index 2 6 5 2 5 6 4 Index 6 two 3s find index 2 5 6 2 6 5 5example 2input arr 1051010output 5034explanation Index 0 two 10 find index 2 3 0 2 0 3 5 index 1 there 5 array sum interval identical element 0 index 2 two 10 find index 0 3 2 0 2 3 3 Index 3 two 10 find index 0 2 3 0 3 2 4 Constraintsn arrlength1 n 1051 arri 105