how to solve this problem using top down approach. and if we cont solve this problem using top down approach then tell me the reason
Count Number of Binary Strings
@deepaksharma42045 yes we can solve this question using top down
we do recursion with 2 things first one is the id and the second one is the number to which this sequence is ending and then
- if the value is 1 then ans is rec(i-1,0) for current i
- if the value is 0 then the ans is rec(i-1,1) +rec(i-1,0)
3, add base case when i==1 ans is 1
Coding Blocks IDE
this is the implemented code if you still have any issue let me know and if clear please mark it as solved and rate my experience
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.