@@ -0,0 +1,645 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A# @Author: Zeyuan Shang%0A# @Date:   2015-11-24 02:29:22%0A# @Last Modified by:   Zeyuan Shang%0A# @Last Modified time: 2015-11-24 02:29:28%0Aclass Solution(object):%0A    def maxProfit(self, prices):%0A        %22%22%22%0A        :type prices: List%5Bint%5D%0A        :rtype: int%0A        %22%22%22%0A        if not prices:%0A            return 0%0A        n = len(prices)%0A        buy = %5B0%5D * n%0A        sell = %5B0%5D * n%0A        buy%5B0%5D = -prices%5B0%5D%0A        for i in range(1, n):%0A            buy%5Bi%5D = max(-prices%5Bi%5D, buy%5Bi - 1%5D, sell%5Bi - 2%5D - prices%5Bi%5D)%0A            sell%5Bi%5D = max(sell%5Bi - 1%5D, buy%5Bi - 1%5D + prices%5Bi%5D)%0A        return max(sell)

add best-time-to-buy-and-sell-stock-with-cooldown