Bug Report for jump-game
Closed this issue · 1 comments
silacode commented
Bug Report for https://neetcode.io/problems/jump-game
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
The submit tests are wrong. How does this gets true where nums=[2,5,0,0]
crank-chips commented
same question. Once we jumped on the index 2 from 0, we cannot jump anymore since we have 0 jump length, so we cannot jump to the last index of array
UPDATE: Oh, actually I got it. So the value is not exact jump we have to make, but the maximum jump length at that position. So in this case from 0 index we have ability to jump 1 or 2 indices, so we jump on index 1, and once we are at index 1 we have options [1,2,3,4,5] and so to reach the end we chose 2