@@ -0,0 +1,819 @@
+class Solution:%0A    # @param prices, a list of integer%0A    # @return an integer%0A%0A    def maxProfit(self, prices):%0A        l = len(prices)%0A        if l %3C 2:%0A            return 0%0A        cur_min = cur_max = prices%5B0%5D%0A        res = 0%0A        is_up = True%0A        for i in xrange(1, l):%0A            if is_up:%0A                if prices%5Bi%5D %3E prices%5Bi-1%5D:%0A                    cur_max = prices%5Bi%5D%0A                else:%0A                    res += cur_max-cur_min%0A                    is_up = False%0A                    cur_min = prices%5Bi%5D%0A            else:%0A                if prices%5Bi%5D %3C prices%5Bi-1%5D:%0A                    cur_min = prices%5Bi%5D%0A                else:%0A                    is_up = True%0A                    cur_max = prices%5Bi%5D%0A        if is_up and cur_max %3E cur_min:%0A            res += cur_max-cur_min%0A        return res%0A

add solution for Best Time to Buy and Sell Stock II