Week 6 · Day 38 of 42

Dynamic Programming: Longest Increasing Subsequence

dp[i] = length of LIS ending at index i. For each j < i, if nums[j] < nums[i]: dp[i] = max(dp[i], dp[j]+1).

Checking access

Spotted a mistake on this page?

Wrong formula, broken animation or confusing wording. Tell us and we will fix it.