@@ -0,0 +1,716 @@
+/**%0A * Problem Link: https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/%0A * %0A */%0Apublic class Solution %7B%0A    public int maxProfit(int%5B%5D prices) %7B%0A        int profit = 0;%0A        int buy = Integer.MAX_VALUE;%0A        int n = prices.length;%0A        for(int i=0; i%3Cn - 1; i++) %7B%0A            if(prices%5Bi%5D %3C= prices%5Bi+1%5D) %7B%0A                buy = Math.min(prices%5Bi%5D, buy);%0A            %7D else if(prices%5Bi%5D %3E prices%5Bi+1%5D && buy != Integer.MAX_VALUE) %7B%0A                profit += prices%5Bi%5D - buy;%0A                buy = Integer.MAX_VALUE;%0A            %7D%0A        %7D%0A        if(buy != Integer.MAX_VALUE && prices%5Bn-1%5D %3E= prices%5Bn-2%5D) %7B%0A            profit += prices%5Bn-1%5D - buy;%0A        %7D%0A        return profit;%0A    %7D%0A%7D%0A

Create Best_Time_to_Buy_and_Sell_Stock_II.java