package leetcode;

/**
 * https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
 */
public class Problem121 {
    public int maxProfit(int[] prices) {
        return 0;
    }
    
    public static void main(String[] args) {
        Problem121 prob = new Problem121();
        System.out.println(prob.maxProfit(new int[]{1, 2, 4, 2, 1, 3}));
    }
}

@@ -165,16 +165,418 @@
     
-return 0
+int%5B%5D max = new int%5Bprices.length%5D;%0A        int m = -1;%0A        for (int i = prices.length-1; i != 0; i--) %7B%0A            max%5Bi%5D = Math.max(m, prices%5Bi%5D);%0A            m = max%5Bi%5D;%0A        %7D%0A        int profit = 0;%0A        for (int i = 0; i %3C prices.length-1; i++) %7B%0A            int buy = prices%5Bi%5D;%0A            int sell = max%5Bi+1%5D;%0A            profit = Math.max(profit, sell-buy);%0A        %7D%0A        return profit
 ;%0A  
@@ -746,16 +746,89 @@
 , 3%7D));%0A
+        System.out.println(prob.maxProfit(new int%5B%5D%7B3, 2, 6, 5, 0, 3%7D));%0A
     %7D%0A%7D%0A

Update problem 121 (not verified)