Optum interview question

Print subsequence of given array