<awangdev>122. Best Time to Buy and Sell Stock II_6.java
private int dfs(int[] prices, int index, boolean sellStatus) {

        if (index == prices.length - 1) {
            return sellStatus ? prices[index] : 0;
        }
        int profit = 0;
        for (int i = index; i < prices.length; i++) {
            profit = Math.max(profit, dfs(prices, i + 1, sellStatus));
            int levelDelta = sellStatus ? prices[i] : - prices[i];
            profit = Math.max(profit, dfs(prices, i + 1, !sellStatus) + levelDelta);
        }
        return profit;
    }
private int sample_funcname ( int [ ] prices , int index , boolean sellStatus ) {
  if ( index == prices . length - 1 ) {
    return sellStatus ? prices [ index ] : 0 ;
  }
  int profit = 0 ;
  for ( int i = index ;
  i < prices . length ;
  i ++ ) {
    profit = Math . max ( profit , dfs ( prices , i + 1 , sellStatus ) ) ;
    int levelDelta = sellStatus ? prices [ i ] : - prices [ i ] ;
    profit = Math . max ( profit , dfs ( prices , i + 1 , ! sellStatus ) + levelDelta ) ;
  }
  return profit ;
}
