What will be the answer if it is not possible to reach the end of the array ? ( Suppose we encounter a 0 ).
Minimum Jumps Required ( 0 )
Hello @Abhishek1996,
This case is not specified in the question because all the testcases regarding this problem does not contain 0.
But, if you reach at an index with value 0 then the program will stuck there.
The pointer cannot move anywhere from that location.
To handle such case, you can print -1.
-1 specifies the case, when it is impossible to reach the end.
Hope, this would help.
Give a like, if you are satisfied.