<awangdev>Palindrome Partitioning II_3.java
public int minCut(String s) {
        if (s == null || s.length() == 0) {
            return 0;
        }
        int length = s.length();
        boolean[][] isPal = new boolean[length][length];
        int[] cut = new int[length];
        for (int j = 0; j < length; j++) {
            cut[j] = j;
            for (int i = 0; i <= j; i++) {
                if (s.charAt(i) == s.charAt(j) && (j - i <= 1 || isPal[i + 1][j - 1])) {
                    isPal[i][j] = true;
                    if (i > 0) {
                        cut[j] = Math.min(cut[j], cut[i - 1] + 1);
                    } else {
                        cut[j] = 0;
                    }
                }
            }
        }
        return cut[length - 1];
    }
public int sample_funcname ( String var_1 ) {
  if ( var_1 == null || var_1 . length ( ) == 0 ) {
    return 0 ;
  }
  int length = var_1 . length ( ) ;
  boolean [ ] [ ] var_6 = new boolean [ length ] [ length ] ;
  int [ ] var_7 = new int [ length ] ;
  for ( int var_8 = 0 ;
  var_8 < length ;
  var_8 ++ ) {
    var_7 [ var_8 ] = var_8 ;
    for ( int var_9 = 0 ;
    var_9 <= var_8 ;
    var_9 ++ ) {
      if ( var_1 . charAt ( var_9 ) == var_1 . charAt ( var_8 ) && ( var_8 - var_9 <= 1 || var_6 [ var_9 + 1 ] [ var_8 - 1 ] ) ) {
        var_6 [ var_9 ] [ var_8 ] = true ;
        if ( var_9 > 0 ) {
          var_7 [ var_8 ] = Math . min ( var_7 [ var_8 ] , var_7 [ var_9 - 1 ] + 1 ) ;
        }
        else {
          var_7 [ var_8 ] = 0 ;
        }
      }
    }
  }
  return var_7 [ length - 1 ] ;
}
