If the absolute difference of current pair ( i , j ) is greater than the maximum difference calculated till now , update the value of result .
if ( calculateDiff ( $ i , $ j , $ arr ) > $ result ) $ result = calculateDiff ( $ i , $ j , $ arr ) ; } } return $ result ; }