<awangdev>122. Best Time to Buy and Sell Stock II_2.java
public int maxProfit(int[] prices) {
        if (prices == null || prices.length <= 1) {
            return 0;
        }
        int curr = 0;
        int profit = 0;
        int peek = 1;
        while(curr < prices.length) {
            while (peek < prices.length && prices[peek - 1] <= prices[peek]) {
                peek++;
            }
            profit += prices[peek - 1] - prices[curr];
            curr = peek;
            peek = curr + 1;
        }
        return profit;
    }
public int sample_funcname ( int [ ] var_0 ) {
  if ( var_0 == null || var_0 . length <= 1 ) {
    return 0 ;
  }
  int var_5 = 0 ;
  int var_6 = 0 ;
  int var_7 = 1 ;
  while ( var_5 < var_0 . length ) {
    while ( var_7 < var_0 . length && var_0 [ var_7 - 1 ] <= var_0 [ var_7 ] ) {
      var_7 ++ ;
    }
    var_6 += var_0 [ var_7 - 1 ] - var_0 [ var_5 ] ;
    var_5 = var_7 ;
    var_7 = var_5 + 1 ;
  }
  return var_6 ;
}
