


N = 5
JUMP = [1,2,3,4,5]
ANSWER:- The answer should be YES as you can jump from 1st index to 2nd index, from 2nd index to 4th index, and from 4th index to 5th index.
The first line contains an integer ‘N’ denoting the length of the array 'JUMP'.
The second line contains ‘N’ integers which denote values of 'JUMP'.
"YES" is printed if the function returns true, otherwise "NO".
You are not required to print anything, it has already been taken care of. Just implement the function.
Use Dynamic Programming to find out the position you can reach. If you can reach the last position return True, else return False. A position i is reachable if DP[j] is 1 and j+JUMP[j] is greater than equal to i. Instead of updating the full range that can be reached from position i, mark the starting and ending points that can be reached from the ith position.