Compute longest increasing subsequence | TikTok Interview Question