<awangdev>849. Maximize Distance to Closest Person_1.java
public int maxDistToClosest(int[] seats) {
        if (seats == null || seats.length == 0) return -1;
        
        int n = seats.length, dist = 0;
        int start = seats[0] == 1 ? 0 : -1; 
        
        for (int end = 1; end < n; end++) {
            if (seats[end] == 1) {
                if (start == -1) dist = end;
                else dist = Math.max(dist, (end - start) / 2);
                start = end; 
            } 
        }
        
        if (seats[n - 1] == 0) dist = Math.max(dist, n - 1 - start);
        
        return dist;
    }
public int sample_funcname ( int [ ] var_0 ) {
  if ( var_0 == null || var_0 . length == 0 ) return - 1 ;
  int var_5 = var_0 . length , var_6 = 0 ;
  int var_7 = var_0 [ 0 ] == 1 ? 0 : - 1 ;
  for ( int var_8 = 1 ;
  var_8 < var_5 ;
  var_8 ++ ) {
    if ( var_0 [ var_8 ] == 1 ) {
      if ( var_7 == - 1 ) var_6 = var_8 ;
      else var_6 = Math . max ( var_6 , ( var_8 - var_7 ) / 2 ) ;
      var_7 = var_8 ;
    }
  }
  if ( var_0 [ var_5 - 1 ] == 0 ) var_6 = Math . max ( var_6 , var_5 - 1 - var_7 ) ;
  return var_6 ;
}
