String count

Given an integer A,
Find and return (total number of binary strings of length A, without having consecutive 1’s) % 10^9 + 7.



Input Format

The only argument given is integer A.

Output Format

Return  (total number of binary strings of length A, without having consecutive 1's) % 10^9 + 7.

Constraints

1 <= A <= 10^5

For Example

Input 1:
    A = 2
Output 1:
    3
Explaination 1:
    "00"
    "01"
    "10"

Input 2:
    A = 3
Output 2:
    5
Explaination 2:
    "000"
    "001"
    "010"
    "100"
    "101"
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving String count on Interview Code Editor
Sign Up
to access hints and editorial solutions for String count

Discussion


Loading...
Click here to start solving coding interview questions