Why code is not working for n=50,100 or anything larger

why code is not working for n=50,100 or anything larger
code-https://ide.codingblocks.com/s/321906

hi anubhav,
In your code you dont need rec function.When you are using that function it is taking a lot of time because it is using exponential time which is destroying the purpose of memorization.
Your recbu function is correct.


see it is giving negative value for 100

hi @anubhavb11,
It is because value for 100 is too large, it cannot be stored in int.
Please let me know if there is any other doubt.