Need help solving Probelm

Revision en1, by peaceful_warrior, 2015-06-15 10:14:48

Problem link I have seen the solution but i dont understand how the recurrance relation is dp[i]=dp[i-1]+dp[i-2]+2;

Can somebody explain it to me.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English peaceful_warrior 2015-06-15 10:14:48 226 Initial revision (published)