Count Binary Strings of length N which has no consecutive ones

Wouldn’t be the answer: pow(2,N) - 1

@Rhinorox how so? please elaborate

For n = 3, ans = 5

1 1 1, 0 0 0, 1 0 0, 0 1 0, 0 0 1, 1 1 0, 1 0 1, 0 1 1 excluding first one.

@Rhinorox

000 //ok
001 //ok
010 //ok
011 //not ok
100 //ok
101 //ok
110 //not ok
111 //not ok

As you can see here, the count is 5.

Thank you very much, Ishita .

@Rhinorox please mark the doubt as resolved :slight_smile: