Count Binary Strings Without Consecutive 1s
Computer Mathematics
Hard
3 views
Problem Description
Given n, count length-n binary strings with no '11'.
Input Format
One integer n.
Output Format
One integer count.
Official Solution
Let dp0,dp1 counts ending with 0/1. Transition: new0=dp0+dp1, new1=dp0. Answer dp0+dp1.
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!