recursive solution and arrays

how would i have a recursive solution that takes the last number of the array, then can move either one or two spaces to the left(towards beginning of the array) while adding up the least amount.

0 3 80 6 57 10

start at 10
if
10+57>10+6
move to 6

if 10+6+80>10+6+3
move to 3

Path from 10 to 0 = min(path from 57 to 0, path from 6 to 0)+10
Write a pathFrom function that takes one int (index) and returns a sum using the formula above. Remember that pathFrom = array[index] when index < 3.
Topic archived. No new replies allowed.