<awangdev>265. Paint House II_2.java
public int minCostII(int[][] costs) {
        if (costs == null || costs.length == 0) return 0;
        if (costs.length == 1 && costs[0].length == 1) return costs[0][0];

        int n = costs.length, k = costs[0].length;
        int[][] dp = new int[2][k]; 
        
        for (int i = 1; i <= n; i++) {
            for (int j = 0; j < k; j++) {
                dp[i % 2][j] = Integer.MAX_VALUE;
                for (int m = 0; m < k; m++) {
                    if (j == m) continue; 
                    dp[i % 2][j] = Math.min(dp[i % 2][j], dp[(i - 1) % 2][m] + costs[i - 1][j]);
                }
            }
        }
        
        int min = Integer.MAX_VALUE;
        for (int j = 0; j < k; j++) min = Math.min(min, dp[n % 2][j]);
        return min;
    }
public int sample_funcname ( int [ ] [ ] var_0 ) {
  if ( var_0 == null || var_0 . length == 0 ) return 0 ;
  if ( var_0 . length == 1 && var_0 [ 0 ] . length == 1 ) return var_0 [ 0 ] [ 0 ] ;
  int var_5 = var_0 . length , var_6 = var_0 [ 0 ] . length ;
  int [ ] [ ] var_8 = new int [ 2 ] [ var_6 ] ;
  for ( int var_9 = 1 ;
  var_9 <= var_5 ;
  var_9 ++ ) {
    for ( int var_10 = 0 ;
    var_10 < var_6 ;
    var_10 ++ ) {
      var_8 [ var_9 % 2 ] [ var_10 ] = Integer . MAX_VALUE ;
      for ( int var_13 = 0 ;
      var_13 < var_6 ;
      var_13 ++ ) {
        if ( var_10 == var_13 ) continue ;
        var_8 [ var_9 % 2 ] [ var_10 ] = Math . min ( var_8 [ var_9 % 2 ] [ var_10 ] , var_8 [ ( var_9 - 1 ) % 2 ] [ var_13 ] + var_0 [ var_9 - 1 ] [ var_10 ] ) ;
      }
    }
  }
  int min = Integer . MAX_VALUE ;
  for ( int var_10 = 0 ;
  var_10 < var_6 ;
  var_10 ++ ) min = Math . min ( min , var_8 [ var_5 % 2 ] [ var_10 ] ) ;
  return min ;
}
