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

Create Best_Time_to_Buy_and_Sell_Stock.java