1. There is a frog who has to cross the river by jumping on stones, the river is divided into x untis 2. You are given an array of positions of stones, in ascending order. For example if array is: 0 2 5 6, first stone is at 0th unit of river, then 2nd, then 5, then 6th 3. Frog ALWAYS starts from 0th position (first stone is always 0), jumps only forward and if its previous jump was n units, next jump can be either n-1 or n+1 units 3. You need to find if the frog can reach the last stone and hence, cross the river 4. Input and output is handled for you 5. It is a functional problem ,please do not modify main() NOTE: assume that his first jump is 1 unit
Input Format
Input is handled for you
Output Format
Output is handled for you
Constraints
2>=length of array < 1,100 Stone position is a positive integer
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
7 0 1 3 4 5 7 8
Output
true