問題:求數組的最長上升子序列問題
思路:第一種方法使用動態規劃方法,用dp(i)來表示從0到i之間的最長上升子序列的長度。狀態轉移方程爲dp(i)=max{dp(j)+1},其中0<=j<i,並且有 nums[i] > nums[j]
第二種方法是用d(i)來表示最長上升子序列長度爲i時,d(i)的值是最小的。
具體代碼參考:
https://github.com/wuli2496/OJ/tree/master/LeetCode/Longest%20Increasing%20Subsequence