Amazon interview question

Longest increasing subsequence related question from DP