CodingMedium
Count binary strings without consecutive 1s
Filed under Swiggy
The question
Count the number of binary strings of length N without consecutive 1's. First write a recursive solution, then dynamic programming, and finally optimize it further using matrix exponentiation.
No write-up yet. Related questions below have one.
Related Swiggy questions
Collected from public candidate posts and coding forums. Updated Nov 2026.