Gainsight interview question

longest subsequence sum