JUMP GAME DP question

Given an array of non-negative integers, you are initially positioned at the first index of the array.

Each element in the array represents your maximum jump length at that position.

Determine if you are able to reach the last index.

https://ide.codingblocks.com/s/256271---why is it giving run error for this

hello @Vibhuti0206

i dont see any logical issue in ur code.
pls send the constraint mentioned in the question

Constraints: 1 <= nums.length <= 3 * 10^4 0 <= nums[i][j] <= 10^5…these are the constrains

but i have a doubt here,since run error is basically when we have segmentation fault i.e when any variable goes out of bound,how can here it give runt time error? could you tell about the probable reasons of run error

reason for run error-> runtime jhol

if u have problem link then pls share it with me, i try to debug by submitting there

https://leetcode.com/explore/interview/card/top-interview-questions-medium/111/dynamic-programming/807/,this is leetcode medium interview questions…jump ga,e

Their was just a small mistake in your code , just see the below pic , the test case shown there was the case which was failing .

The only mistake was that for 0,2,3 case , you can’t reach to 2 but from 2 , you can reach to 3 thus your code gives true but actually it should be false as you can never reach 2 .

i got the mistake,but why was it giving run time error…isn’t runtime rror supposed to be when we go out of bound and here we were not accessing anything beyond memory? so shouldnot it have given wrong answer as eerror?

See, i am running your same code and getting WA but not a runtime error , can you send me a pic ??