Find the number of binary strings of length N with at least 3 consecutive 1s

Revision en1, by dahiyakuldeep304, 2021-01-30 09:00:04

we have an integer N, We have to find the number of all possible distinct binary strings of the length N, which have at least three consecutive 1s. So if n = 4, then the numbers will be 0111, 1110, 1111, so output will be 3.

Can anyone have any idea how to use dynamic programming here. It will be a great help. Thanks for advance.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English dahiyakuldeep304 2021-01-30 09:00:04 413 Initial revision (published)