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