Urahara_kisukue's blog

By Urahara_kisukue, history, 21 month(s) ago, In English

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

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it