Maximum difference of adjacent elements of remaining array
let maxDiff = Number . MIN_VALUE ; for ( let j = 0 ; j < temp . length - 1 ; j ++ ) { maxDiff = Math . max ( maxDiff , temp [ j + 1 ] - temp [ j ] ) ; } minDiff = Math . min ( minDiff , maxDiff ) ; } } return minDiff ; }