Help in dp problem

Revision en2, by Urahara_kisukue, 2022-09-15 07:08:28

I was trying to solve that problem on csesCounting towers I wrote that snippet for it and it is failing. I do want to know why thank you in advance. *Note I have not added memoization to it.

**def fn(x): if x==1: return 2 if x==2: return 8 opt=0 for k in range(1,x): if x-k >=0 and k>0: opt+=(((fn(k)*fn(x-k))-1)) return opt+1 **

Tags dynamic programming

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English Urahara_kisukue 2022-09-15 07:15:40 24
en2 English Urahara_kisukue 2022-09-15 07:08:28 180
en1 English Urahara_kisukue 2022-09-15 04:32:38 250 Initial revision (published)