Question: 1 Consistent data A sequence containing only 0 s and 1 s is called a consistent sequence if no adjacent values in the sequence are

1 Consistent data
A sequence containing only 0s and 1s is called a consistent sequence if no adjacent values in the sequence are the same. For example (010101dots) is a consistent sequence while (011) is not. You are allotted a simple task.
Given an integer N that represents the size of a consistent sequence starting with '0'.
Fine out the number of consistent subsequences of the given sequence mod 109+7.
Note: A subsequence is a sequence that can be derived from the given sequence by deleting zero or more elements without changing the order of the remaining elements.
Function description
Complete the function Consistent(). This function takes the following parameter and returns the required answer:
N : Represents the size of the sequence
Input format for custom testing
Note: Use this input format if you are testing against custom input or writing code in a language where we don't provide boilerplate code
The first line contains an integer N representing the sequence's size. Output format
Print the number of consistent subsequences mod 109+7.
Constraints
1N106
 1 Consistent data A sequence containing only 0s and 1s is

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!