India’s Best Job Seekers and Training Platform Forums Algorithm Solutions Discussion Count number of strings of length N with following properties …

  • Count number of strings of length N with following properties …

  • Akash 

    Administrator
    at

    Count number of strings of length N with following properties:

    A. Consists of char ‘A’ and ‘B’ only.

    B. There is atleast one occurrence of 3 consecutive Bs.

    Input: Only line having integer N.

    Output: Number of string with given properties. As then number can be very large print it with modulo 10^9+7.

    Sample Input 1:

    3

    Sample Input 2:

    1

    Explanation: Only possible string “BBB”

Log in to reply.

Original Post
0 of 0 posts June 2018
Now
KodNest Training New Batch is starting on 19th October 2020. Attend one week free demo classes.Register Now

New Report

Close