Jumping Saurabh

5

1 votes
Easy
Problem

Saurabh is a notorious kid! He likes jumping and he's really a master in it. There is a sequence of platforms through which he has to jump. quite an easy right! But one of his friend Yash wants to test Saurabh's smartness by observing whether he can jump to the last platform in minimum jumps or not. So he starts marking platform with a number written on it. Yash says to Saurabh that he can jump at max n(number written on the ith platform) from the current platform(maximum jump length). Help Saurabh to prove his smartness.

Input

The first line contains a number of test cases, followed by in next line n(number of platforms) third line space separated non-negative integers.

Output

one line minimum number of jumps, if he not able to reach print -1

  Constraints

1<n<105

0<ith<20

1<T<100

Sample Input
1
5
2 1 2 1 2 
Sample Output
2
Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?