I'm currently working on recursion and i keep getting stuck at this question:
Find the cheapest path through an array using recursion. for example, if i had an array [0,1,3,4,1] i start at the value 0. Now i have 2 options i could jump to index 2 or just move to index 1.In this case i would jump right to index 2 (value 3) then jump to index 4 (value 1) because 3+1= 4 and that would be the cheapest way through the array.
I've tried to compare the move index value with the jump index value and see which is smallest but in this case that would not work because if i compare move value (1) with jump value (3), 1 is smallest and my program would take that as the correct path when in reality it is not and the 3 was a better option.
Thank you for taking the time to help!