An array A with N integers . Each element can be treated as a pointer to others : if A[K] = M then A[K] points to A[K+M]. The array defines a sequence of jumps as follows:
- initially, located at element A[0];
- on each jump , moves from current element to the destination pointed to by the current ; i.e. if on element A[K] then it jumps to the element pointed to by A[K];
- it may jump forever or may jump out of the array.
Write a function: that, given a array A with N integers, returns the number of jumps after which it will be out of the array.