comefrom: <awangdev>122. Best Time to Buy and Sell Stock II_5.java
code: public int maxProfit(int[] prices) {
          if (prices == null || prices.length <= 1) {
              return 0;
          }
          int[] buyOn = new int[prices.length];
          int[] sellOn = new int[prices.length];
          int length = prices.length;
          buyOn[length - 1] = 0;
          sellOn[length - 1] = prices[length - 1];
          for (int i = length - 2; i >= 0; i--) {
              buyOn[i] = Math.max(buyOn[i + 1], sellOn[i + 1] - prices[i]); 
              sellOn[i] = Math.max(sellOn[i + 1], buyOn[i + 1] + prices[i]);
          }
          return Math.max(0, buyOn[0]);
      }
masked: public int sample_funcname ( int [ ] var_0 ) {
    if ( var_0 == null || var_0 . length <= 1 ) {
      return 0 ;
    }
    int [ ] var_1 = new int [ var_0 . length ] ;
    int [ ] var_2 = new int [ var_0 . length ] ;
    int length = var_0 . length ;
    var_1 [ length - 1 ] = 0 ;
    var_2 [ length - 1 ] = var_0 [ length - 1 ] ;
    for ( int var_3 = length - 2 ;
    var_3 >= 0 ;
    var_3 -- ) {
      var_1 [ var_3 ] = Math . max ( var_1 [ var_3 + 1 ] , var_2 [ var_3 + 1 ] - var_0 [ var_3 ] ) ;
      var_2 [ var_3 ] = Math . max ( var_2 [ var_3 + 1 ] , var_1 [ var_3 + 1 ] + var_0 [ var_3 ] ) ;
    }
    return Math . max ( 0 , var_1 [ 0 ] ) ;
  }
  