Returns true if a permutation of arr [ 0. . n - 1 ] can form arithmetic progression
function compare ( a , b ) { if ( a < b ) { return - 1 ; } else if ( a > b ) { return 1 ; } else { return 0 ; } } function checkIsAP ( arr , n ) { if ( n == 1 ) return true ;