Trouble with size of the answer

My code is working fine for smaller input values but not for values of N greater than around 10^3. Even though I have used long long int.

@sankalp.sharma99
hello Sankalp,
are u using recusion?

yes I am, should I attach my code?

@sankalp.sharma99
its time complexity is roughly 2^n thats why it is working for small test case only .to optimise ur code use dynamic programming

yeah that’s what I figured. Thanks