Count number of binary strings

Two test cases not passing

u need to reinitialise ur dp table to 0 again after each test case. otherwise it will interfere with the values of the previous test case.

i tried that using memset but still got the same result

I will advise u to please think again on the recurrence relation because this is not the way I have seen anywhere.
Hint : think of Fibonacci

but fibonacci will come in bottom up right , the top down approach shown in video is what i have used

No u can use Fibonacci can be calculated using top down also.

but i used the other approach shown in video , please tell me the error in this approach

i am sorry i cant see the video.

https://online.codingblocks.com/app/player/53970/content/109601/5933/lecture

video link of the method

I don’t have access sorry .