# Rohit Interview
Given an array of integers where each element represents the max number of steps that can be made forward from that element. Write a function to return the minimum number of jumps to reach the end of the array (starting from the first element). If an element is 0, they cannot move through that element. If the end isn’t reachable, return -1.
Examples:
Input: arr[] = {1, 3, 5, 8, 9, 2, 6, 7, 6, 8, 9}
{3 2 2 1 1 2 1 1 1 1 , 0}
{1, 3, 5}
jumps={0, 1, 2, 2
reach=9
Output: 3 (1-> 3 -> 8 -> 9)
Explanation: Jump from 1st element
to 2nd element as there is only 1 step,
now there are three options 5, 8 or 9.
If 8 or 9 is chosen then the end node 9
can be reached. So 3 jumps are made.
Input: arr[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
Output: 10
Explanation: In every step a jump
is needed so the count of jumps is 10.
The first element is 1, so can only go to 3. The second element is 3, so can make at most 3 steps eg to 5 or 8 or 9.
#1. Read and ask questions
#2. Think possible Solutions
#3. Discuss and optimize if possible
#4. [Code](https://www.jdoodle.com/online-java-compiler/#&togetherjs=5DdtaoBkpl)
#5. Execute
jdoodle.com/ia/flo