Count number of binary strings

getting wrong answer on 2 test cases

actually this question is beautiful example of fibonacci series
after solving some example you understand patterns in nothing but fibonacci series
so just write the code of fibonacci series

yes I am aware of that but what’s wrong with this?

home constraints are large
1<=n<=90
so ans will exceed the limt of int hence instead of int use long long int

i even tried using fibonacci logic but its again failing on first 2 test cases

have you tried this?

this is modified code
i have only use long long int instead of int


this is passing all test cases

1 Like

thank you,working now!

1 Like

why i cant see your code.?
only the ide opens