Returns - 1 if number x is greater than the largest element of arr
if ( n % 2 == 1 && arr [ r ] [ r ] < x ) return -1 ; if ( n % 2 == 0 && arr [ r + 1 ] [ r ] < x ) return -1 ; while ( l < r ) { int mid = ( l + r ) / 2 ; if ( arr [ mid ] [ mid ] <= x ) if ( mid == ( n + 1 ) / 2 - 1 arr [ mid + 1 ] [ mid + 1 ] > x ) return mid ; else l = mid + 1 ; else r = mid - 1 ; } return r ; }