<gouthampradhan>math_GlobalAndLocalInversions_1.java
public boolean isIdealPermutation(int[] A) {
    if (A.length == 0 || A.length == 1) return true;
    int max = Integer.MIN_VALUE;
    for (int i = 1; i < A.length; i++) {
      if (A[i] < max) {
        return false;
      } else {
        max = Math.max(max, A[i - 1]);
      }
    }
    return true;
  }
public boolean var_0 ( int [ ] var_1 ) {
  if ( var_1 . length == 0 || var_1 . length == 1 ) return true ;
  int max = Integer . MIN_VALUE ;
  for ( int var_8 = 1 ;
  var_8 < var_1 . length ;
  var_8 ++ ) {
    if ( var_1 [ var_8 ] < max ) {
      return false ;
    }
    else {
      max = Math . max ( max , var_1 [ var_8 - 1 ] ) ;
    }
  }
  return true ;
}
