<awangdev>256. Paint House_3.java
public int minCost(int[][] costs) {
        if (costs == null || costs.length == 0) return 0;
        int n = costs.length, m = costs[0].length;
        int[][] dp = new int[2][m]; 
        
        for (int i = 1; i <= n; i++) {
            int curr = i % 2, last = (i - 1) % 2;
            for (int j = 0; j < m; j++) {
                dp[curr][j] = Integer.MAX_VALUE;
                for (int k = 0; k < m; k++) {
                    if (j == k) continue; 
                    dp[curr][j] = Math.min(dp[curr][j], dp[last][k] + costs[i - 1][j]);
                }
            }
        }
        
        int min = Integer.MAX_VALUE;
        for (int j = 0; j < m; 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 ;
  int var_4 = var_0 . length , var_5 = var_0 [ 0 ] . length ;
  int [ ] [ ] var_7 = new int [ 2 ] [ var_5 ] ;
  for ( int var_9 = 1 ;
  var_9 <= var_4 ;
  var_9 ++ ) {
    int var_10 = var_9 % 2 , var_11 = ( var_9 - 1 ) % 2 ;
    for ( int var_12 = 0 ;
    var_12 < var_5 ;
    var_12 ++ ) {
      var_7 [ var_10 ] [ var_12 ] = Integer . MAX_VALUE ;
      for ( int var_15 = 0 ;
      var_15 < var_5 ;
      var_15 ++ ) {
        if ( var_12 == var_15 ) continue ;
        var_7 [ var_10 ] [ var_12 ] = Math . min ( var_7 [ var_10 ] [ var_12 ] , var_7 [ var_11 ] [ var_15 ] + var_0 [ var_9 - 1 ] [ var_12 ] ) ;
      }
    }
  }
  int min = Integer . MAX_VALUE ;
  for ( int var_12 = 0 ;
  var_12 < var_5 ;
  var_12 ++ ) min = Math . min ( min , var_7 [ var_4 % 2 ] [ var_12 ] ) ;
  return min ;
}
