Concept Flow - Longest Increasing Subsequence
Start with empty LIS array
For each element in input array
Find position in LIS to place element
If element > all in LIS, append
Else replace element in LIS to keep it minimal
Repeat for all elements
Length of LIS array is result
We build a list representing the smallest possible last elements of increasing subsequences of different lengths. For each input element, we find where it fits to keep this list minimal and increasing.
