Dynamic Programming - 2

Covered in this section:

DP on subsequences

Target Sum (LeetCode)

Longest increasing subsequences

Tabulation approach: (O(n^2) approach) => Our fundamental state dp[i] becomes: longest increasing subsequence ending at ith index. We initialize dp[0] = 1, then for i, we look for j from 0 to i-1 such that num[j] is less than num[i] and update dp[i] = max(dp[i], num[j]+1).
Using binary search:

Next Lesson