I have submitted this question. However, I can’t solve it using a 2D DP array. Please help me with the solution.
Count Number of Binary Strings
Hey @gptradhika1208
This is not 2d dp but 1d dp instead.
Actually its simple fibonacci
Output pattern is fibonacci
Now we need to form numbers with no consecutive ones.
So for n=1 we can form 0 or 1 so ans =2
for n=2 we can form 0+(0,1) or 1+(0) = 3
for n=3 we can form 00+(0,1) or 10+(0,1) or 01+(1) =5
and so on
so 2,3,5,8,13,…