Infosys interview question

DSA question includes longest subsequence