An array of costs was given.
You can either take two jumps forward or one jump backward. If you land on a particular index, you have to add the cost to your total.
Find the minimum cost needed to cross the array or reach the end of the array.Can we use normal DP here? I don't think so because it is not a DAG, since we go back also.
How to solve it?