We may find ARRAYs with different answers

Hi I have the same doubt I will explain it please help if you can i assume i>j
|A[i]-A[j]|-|i-j| can be |A[i]+i-(A[j]+j)| if A[i]-A[j]>0.
|A[i]-A[j]|-|i-j| can be |A[i]-i-(A[j]-j)| if A[i]-A[j]<0.
now if we find max and min of A[x]+x and A[x]-x these are real solutions if
for A[x]+x if A[x1]>A[x2] since Amax>Amin so the value of the index must be Index_max>Index_min.(a)
similarly for A[x]-x if A[x1]>A[x2] since Amax>Amin so the value of the index must be Index_max<Index_min.(b)
Since A[x]+x and A[x]-x are different array so it may be possible that one or both of the a and b statements dont satisfy and in that case I feel we need help and we should use the approach of the problem of finding maximum difference between two index on both the arrays
Please help on ideas for simplification if the statements never go wrong

.

Click here to start solving coding interview questions