<awangdev>256. Paint House_1.java
public int minCost(int[][] costs) {
        int n = costs.length;
        int[][] dp = new int[2][3]; 
        
        for (int i = 1; i <= n; i++) {
            int last = (i - 1) % 2, curr = i % 2; 
            for (int j = 0; j < 3; j++) { 
                dp[curr][j] = Math.min(dp[last][(j + 1) % 3], dp[last][(j + 2) % 3]) + costs[i-1][j];
            }
        }
        
        return Math.min(Math.min(dp[n%2][0], dp[n%2][1]), dp[n%2][2]);
    }
public int sample_funcname ( int [ ] [ ] var_0 ) {
  int var_2 = var_0 . length ;
  int [ ] [ ] var_5 = new int [ 2 ] [ 3 ] ;
  for ( int var_7 = 1 ;
  var_7 <= var_2 ;
  var_7 ++ ) {
    int var_8 = ( var_7 - 1 ) % 2 , var_9 = var_7 % 2 ;
    for ( int var_11 = 0 ;
    var_11 < 3 ;
    var_11 ++ ) {
      var_5 [ var_9 ] [ var_11 ] = Math . min ( var_5 [ var_8 ] [ ( var_11 + 1 ) % 3 ] , var_5 [ var_8 ] [ ( var_11 + 2 ) % 3 ] ) + var_0 [ var_7 - 1 ] [ var_11 ] ;
    }
  }
  return Math . min ( Math . min ( var_5 [ var_2 % 2 ] [ 0 ] , var_5 [ var_2 % 2 ] [ 1 ] ) , var_5 [ var_2 % 2 ] [ 2 ] ) ;
}
