##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
You've learned prefix sums. Now find the longest increasing subsequence and optimize with binary search.
The Goal
The definition
Classic DP problem
The trap
What dp[i] means
The recurrence
The code
Tracing the O(n^2) algorithm
Finding the actual subsequence
Why ending at i
Knowledge check
summary
The optimization idea
O(n log n) code
O(n log n) algorithm trace
Understanding the tails array
Knowledge check
Counting all LIS
Length and count
The code
Counting subsequences
When counts add up
2D LIS variant
2D LIS reduction
LIS on string predecessors
LIS on strings
LIS with divisibility
Hidden pattern
The code
LIS with divisibility
Recognizing the pattern
Classic variation
Sum instead of length
The code
Weighted LIS
Finding the optimal subsequence
Bidirectional LIS
Forward and backward
The code
Two-directional LIS
Understanding the approach
LIS application
LIS for non-decreasing
Recognizing LIS problems
Understanding space usage
Preview of LCS and Edit Distance
What we learned