Virtusa interview question

Array subsequence pattern leetcode question