CRED interview question

Longest common increasing sequence problem