Amazon Interview Question

mountain peek question regarding subsequence