In the remote Himalayas, a sherpa named Raju has developed a unique system to record mountain peaks he encounters during his journeys. As a Google Map contractor mapping unexplored territories, he needs to validate whether certain sequences of peak heights could match his recording system.
Raju's recording system works as follows:
N
(a parameter).
Given a sequence of integers representing recorded peak heights, determine if it could have been produced by Raju's system for some value of N
.
Input:
4 0 3 2 1
Output:
Yes
Input:
4 0 3 1 2
Output:
No