Longest increasing subsequence (tutorial)