Quant Memo
Coding/●●●●●

Binary strings with no two adjacent ones

Count the length-nn binary strings that contain no two consecutive 1s. For n=2n = 2 the valid strings are 00, 01, 10, so the answer is 3.

Find the recurrence, explain the exponential naive count, and give an O(n)O(n) solution.

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions