The question is this.
The solution is something like this:
dp[1] = 1, dp[2] =3 ;
for(int i =3; i <= n ; i++) dp[i] = dp[i — 1] + dp[ i- 2] + 2;
How did one come with the formulation dp[i] = dp[ i — 1 ] + dp[i — 2] + 2 ?
Any help would be really appreciated.
Peace!