<awangdev>Best Time to Buy and Sell Stock III_3.java
public int maxProfit(int[] prices) {
        if (prices == null || prices.length == 0) {
            return 0;
        }
        int[] leftProfit = new int[prices.length];
        int[] rightProfit = new int[prices.length];
        int min = prices[0];    
        for (int i = 1; i < prices.length; i++) {
            min = Math.min(min, prices[i]);
            leftProfit[i] = Math.max(leftProfit[i - 1], prices[i] - min);
        }
        int max = prices[prices.length - 1];    
        for (int i = prices.length - 2; i >= 0; i--) {
            max = Math.max(max, prices[i]);
            rightProfit[i] = Math.max(rightProfit[i + 1], max - prices[i]);
        }
        int profit = 0;
        for (int i = 0; i < prices.length; i++) {
            profit = Math.max(profit, leftProfit[i] + rightProfit[i]);
        }
        return profit;
    }
public int sample_funcname ( int [ ] var_0 ) {
  if ( var_0 == null || var_0 . length == 0 ) {
    return 0 ;
  }
  int [ ] var_4 = new int [ var_0 . length ] ;
  int [ ] var_5 = new int [ var_0 . length ] ;
  int min = var_0 [ 0 ] ;
  for ( int var_8 = 1 ;
  var_8 < var_0 . length ;
  var_8 ++ ) {
    min = Math . min ( min , var_0 [ var_8 ] ) ;
    var_4 [ var_8 ] = Math . max ( var_4 [ var_8 - 1 ] , var_0 [ var_8 ] - min ) ;
  }
  int max = var_0 [ var_0 . length - 1 ] ;
  for ( int var_8 = var_0 . length - 2 ;
  var_8 >= 0 ;
  var_8 -- ) {
    max = Math . max ( max , var_0 [ var_8 ] ) ;
    var_5 [ var_8 ] = Math . max ( var_5 [ var_8 + 1 ] , max - var_0 [ var_8 ] ) ;
  }
  int var_12 = 0 ;
  for ( int var_8 = 0 ;
  var_8 < var_0 . length ;
  var_8 ++ ) {
    var_12 = Math . max ( var_12 , var_4 [ var_8 ] + var_5 [ var_8 ] ) ;
  }
  return var_12 ;
}
