Write a function that takes a list of integers as argument and calculates how you can 'jump' in this list. Take for example the list
List(4, 0, 4, 0, 1, 0, 2,1)
The integers stand for how many "steps" you can jump forward. The first 4, for example, means you can jump to one of the next 4 elements, that is 0, 4, 0 and 1. If you land on a field that contains 0, then you are stuck, or cannot jump any further. If you land on a field with a 1, you can jump only to the next field. If on 2 you can jump to the next field or the one after that. I guess you get the idea.
The point is can you calculate for any list how many jumps you need minimally to jump to the end of the list. I think for the list above you need at least three jumps 4 => 4 => 2 => end-of-list . This should be a nice search problem which you can implement as recursive function.
10 freelancers are bidding on average $28 for this job
Greetings, I am looking forward to doing this project as Scala and functional programming paradigm are my passion. Looking forward to hearing from you. Kind regards, Sava