Jump Game

Practice this coding question on Coding Gurukul.

Problem statement

A delivery robot crosses numbered platforms from left to right. Each platform stores its maximum forward jump. Starting at platform zero, decide whether the robot can reach the last platform. A jump may be any positive length up to the current limit.

Input format

First line: n. Second line: n space-separated integers.

Output format

Print true or false in lowercase.

Constraints

1 <= n <= 10000; 0 <= jump <= 100000.

Sample input

5
2 1 0 2 0

Sample output

false

Sign in to run or submit a solution in C++, Java or Python.