There is an array of 𝑛 coins with values 𝐶 = [𝑐1, 𝑐2, … , 𝑐𝑛]. The prices are positive integers and repetitions are allowed. For example, one possible sequence of coins is as follows: 𝐶7 = [5, 20, 2, 20, 1, 10, 50]. Your goal is to collect the maximum amount of money with the limitation that you will not get two coins lying next to each other in the original row. For example, if get coin 10 from 𝐶7, then you cannot get coins 1 or 50.
Can you find me the recursion equation for this problem?
I tried this but I'm not sure:
M(i) = max{ M(i−1), if we take the coin i
M(i−2)+C[i], if we don't take the coin i