Problem Description

For each testcase you get array where a[i] is max jump length from i. Compute minimum jumps to reach last index, else -1.

Input Format

First integer t. For each: n then n integers.

Output Format

t lines min jumps.

Sample Test Case

Input:
2 5 2 3 1 1 4 5 3 2 1 0 4
Output:
2 -1

Constraints

Sum of n over all testcases

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next