comefrom: <awangdev>Best Time to Buy and Sell Stock IV_4.java
code: public int maxProfit(int k, int[] prices) {
      	if (prices == null || prices.length < 2 || k <= 0) {
      		return 0;
      	}
      	if (k >= prices.length) {
      		int profit = 0;
      		for (int i = 1; i < prices.length; i++) {
      			if (prices[i] > prices[i - 1]) {
      				profit += prices[i] - prices[i - 1];
      			}
      		}
      		return profit;
      	}
      	int[][] local = new int[prices.length][k + 1];
      	int[][] global = new int[prices.length][k + 1];
      	for (int i = 1; i < prices.length; i++) {
      		int diff = prices[i] - prices[i - 1];
      		for (int j = 1; j <= k; j++) {
      			local[i][j] = Math.max(global[i-1][j-1] + diff, local[i - 1][j] + diff);
      			global[i][j] = Math.max(global[i-1][j], local[i][j]);
      		}
      	}
      	return global[prices.length - 1][k];
      }
masked: public int sample_funcname ( int var_0 , int [ ] var_1 ) {
    if ( var_1 == null || var_1 . length < 2 || var_0 <= 0 ) {
      return 0 ;
    }
    if ( var_0 >= var_1 . length ) {
      int var_6 = 0 ;
      for ( int var_8 = 1 ;
      var_8 < var_1 . length ;
      var_8 ++ ) {
        if ( var_1 [ var_8 ] > var_1 [ var_8 - 1 ] ) {
          var_6 += var_1 [ var_8 ] - var_1 [ var_8 - 1 ] ;
        }
      }
      return var_6 ;
    }
    int [ ] [ ] var_9 = new int [ var_1 . length ] [ var_0 + 1 ] ;
    int [ ] [ ] var_10 = new int [ var_1 . length ] [ var_0 + 1 ] ;
    for ( int var_8 = 1 ;
    var_8 < var_1 . length ;
    var_8 ++ ) {
      int var_11 = var_1 [ var_8 ] - var_1 [ var_8 - 1 ] ;
      for ( int var_12 = 1 ;
      var_12 <= var_0 ;
      var_12 ++ ) {
        var_9 [ var_8 ] [ var_12 ] = Math . max ( var_10 [ var_8 - 1 ] [ var_12 - 1 ] + var_11 , var_9 [ var_8 - 1 ] [ var_12 ] + var_11 ) ;
        var_10 [ var_8 ] [ var_12 ] = Math . max ( var_10 [ var_8 - 1 ] [ var_12 ] , var_9 [ var_8 ] [ var_12 ] ) ;
      }
    }
    return var_10 [ var_1 . length - 1 ] [ var_0 ] ;
  }
  