Add dynamic-programming module: ten classic DP problems, memoization vs tabulation vs space-optimised, call-count and pitfall transcripts (11 tests)
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
Longest Increasing Subsequence: [10, 9, 2, 5, 3, 7, 101, 18]
|
||||
============================================================
|
||||
|
||||
a[i] [10, 9, 2, 5, 3, 7, 101, 18]
|
||||
dp[i] [1, 1, 1, 2, 2, 3, 4, 4] (dp[i] = longest increasing subsequence ENDING at index i)
|
||||
|
||||
answer = max(dp) = 4 (for example 2, 3, 7, 18)
|
||||
O(n log n) patience version = 4
|
||||
Reference in New Issue
Block a user