Question: Given an array arr of size N , the task is to find the minimum number of jumps to reach the last index of the

Given an array arr of size N, the task is to find the minimum number of jumps to reach the last index of the array starting from index 0. In one jump, you can jump from current index i to index (i+1) or index (i-1); or you can move from index i to index )(j if arr[i] is equal to arr[j]+2.
Note: You can not jump outside of the array at any time.
Examples:
Input: arr={100,-23,-23,404,98,23,23,23,3,402}
Output: 3
Explanation: Valid jump indices are 0439.
 Given an array arr of size N, the task is to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!