Skip to content

Count Binary Strings

5 min Season 2 Episode 12
Count Binary Strings

Listen to “Count Binary Strings”

Episode synopsis

1. You are given a number n.
2. You are required to print the number of binary strings of length n with no consecutive 0's.
Input Format
A number n
Output Format
A number representing the number of binary strings of length n with no consecutive 0's.
Constraints
0 < n <= 45
Sample Input
6
Sample Output
21

ZARZA Studio — Your station on air today: library, music clock, schedule, studio and reports, from the browser.

Meet ZARZA Studio
— on air now — stations in the catalogue 2,021,841 podcasts — countries