⚡ AlgoZen_
~/home/dynamic_programming/longest_increasing_subsequence5 / 6

Longest Increasing Subsequence

Intermediate

Find the length of the longest strictly increasing subsequence. Uses DP: dp[i] = longest sequence ending at index i, computed by checking all previous elements that are smaller.

time:O(n²)
space:O(n)
⚡ +250_XP
step[1/51]
> Start
10
1
9
1
2
1
5
1
3
1
7
1
101
1
18
1
Longest Increasing Subsequence (LIS) in [10, 9, 2, 5, 3, 7, 101, 18]. Bar height = LIS length ending at each element.

// tap NEXT STEP to walk through one step at a time