Let's jumpComputer Science Level 3
Assume an array of numbers \([4, 2, 5, 1, 0, 3, 7, 8, 6, 9]\). Initially you are standing on the very first number, say '4'. Now jump 4 steps forward (till number '0'). Now you are standing on ZERO hence just step to the next number '3' (doing this is NOT a jump) then jump 3 steps again, you've reached number '6', finally you'll jump 6 steps forward to be out of the array. Collectively, you needed to jump thrice.
How many times do you need to jump in this case?
Details and Assumptions:
- Treat all ZEROS as ONES and do NOT consider it a jump.