Evaluating | arr [ i ] - arr [ j ] | + | i - j | and compare with previous maximum .
ans = ans if ans > ( abs ( arr [ i ] - arr [ j ] ) + abs ( i - j ) ) else ( abs ( arr [ i ] - arr [ j ] ) + abs ( i - j ) ) ; NEW_LINE return ans ; NEW_LINE