Python/Go/JS/C++ O(n) by DP [w/ Visualization] 有中文專欄解析DP框架
Python O(n) by DP + State machine\n\n\u4E2D\u6587\u5C08\u6B04:\n\u5F9EDP\u548CFSM\u6709\u9650\u72C0\u614B\u6A5F\u7684\u89D2\u5EA6\uFF0C\u53BB\u89E3\u958BLeetcod
Python O(n) by DP + State machine\n\n[\u4E2D\u6587\u5C08\u6B04:\n\u5F9EDP\u548CFSM\u6709\u9650\u72C0\u614B\u6A5F\u7684\u89D2\u5EA6\uFF0C\u53BB\u89E3\u958BLeetcode\u6700\u4F73\u80A1\u7968\u8CB7\u8CE3\u7CFB\u5217\u984C\u3002](https://vocus.cc/article/65fd41d2fd897800015721f3)\n\n---\n\n**State machine diagram**:\n\n![image](https://assets.leetcode.com/users/images/1128f24f-0acb-48cd-9de3-13c49ccde4a9_1597935823.84157.png)\n\n---\n\n**Implementation** by bottom-up DP with state machine:\n<iframe src="https://leetcode.com/playground/MSLnVn8i/shared" frameBorder="0" width="800" height="600"></iframe>\n\n---\n\n**Implementation** by Top-down DP + recursion\n<iframe src="https://leetcode.com/playground/RZLuFL45/shared" frameBorder="0" width="800" height="600"></iframe>\n\n---\n\nShare another viewpoint dp solution\n<iframe src="https://leetcode.com/playground/TBNQ8rNj/shared" frameBorder="0" width="800" height="600"></iframe>\n\n\n---\n\nCorresponding equvilent top-down DP + recusrion\n<iframe src="https://leetcode.com/playground/k5WUoupZ/shared" frameBorder="0" width="800" height="600"></iframe>\n\n\n---\n\nRelated leetcode challenge:\n\n[Leetcode #121 Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock)\n\n[Leetcode #122 Best Time to Buy and Sell Stock II](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii)\n\n[Leetcode #123 Best Time to Buy and Sell Stock III ](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii)\n\n[Leetcode #188 Best Time to Buy and Sell Stock IV  ](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv)\n\n[Leetcode #309 Best Time to Buy and Sell Stock with Cooldown](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown)\n\n[Leetcode #714 Best Time to Buy and Sell Stock with Transaction Fee  ](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee) \n\n---
['Dynamic Programming', 'C', 'Python', 'Go', 'JavaScript']