Why it matters
LIS has elegant fast algorithm. Understanding shapes classical DP.
Advertisement
The architecture
Maintain tails[i]: smallest tail of length-(i+1) LIS.
Binary search insert.
Advertisement
How it works end to end
tails: increasing.
Binary search: first tail >= x.
Replace or extend.
Length = tails size.