Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

Jump from one array element to another

Revision en1, by himanshu1212, 2020-08-07 06:47:29

Could anyone please send the code for this problem?

You are given an array of N integers. You have to find the minimum cost that is required to cross the array by jumping from one element to another. You need to start from the first element of the array and you can jump in both directions,but length of forward jump must be 2 and backward jump must be 1.

The cost of forward and backward jump is the value of the element from which you are jumping.,that is the cost of jumping from i index to (i+2) and the cost of jumping from i to (i-1) index is the value of i element of the array

If you are at the last element then you can jump out of the array and cost of that jump will be the value of the last element of array A

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English himanshu1212 2020-08-07 06:47:29 777 Initial revision (published)