摘要:
Well, this problem desires for the use of dynamic programming. They key to any DP problem is to come up with the state equation. In this problem, we d... 阅读全文
摘要:
Recursive (Backtracking)This is a typical problem that can be tackled by backtracking.Since backtracking has a more-or-less similar template, so I do ... 阅读全文
摘要:
This problem is similar toBest Time to Buy and Sell Stock. Givenprices, we find the day (denoted asbuy) of the first local minimum and the day (denote... 阅读全文
摘要:
This post shares a very simple solution, whose code is rewritten below, just 5 lines :-) 1 class Solution { 2 public: 3 int maxProfit(vector& pric... 阅读全文