human
Maximum jumps to reach end of Array with condition that index i can make arr [ i ] jumps | Function to find the maximum jumps to reach end of array.
Stores the jumps needed to reach end from each index.
Traverse the array.
Check if j is less than N.
Add dp [ j ] to the value of dp [ i ].
Update the value of ans.
Print the value of ans.
Driver Code"
How can the above be solved in Python?
 What is a code to maximum jumps to reach end of Array with condition that index i can make arr [ i ] jumps and the other steps required?
assistant
#Here is code to maximum jumps to reach end of Array with condition that index i can make arr [ i ] jumps and the other steps required.
 def findMaxJumps ( arr , N ) :
	dp = [ 0 for i in range ( N ) ]
	ans = 0
	i = N - 1
	while ( i >= 0 ) :
		dp [ i ] = arr [ i ]
		j = i + arr [ i ]
		if ( j < N ) :
			dp [ i ] = dp [ i ] + dp [ j ]
		ans = max ( ans , dp [ i ] )
		i -= 1
	print ( ans )
if __name__ == ' _ _ main _ _ ' :
	arr = [ 2 , 3 , 5 , 7 , 9 ]
	N = len ( arr )
	findMaxJumps ( arr , N )