Count of strings that can be formed using a, b and c under given constraints
Given a length n, count the number of strings of length n that can be made using ‘a’, ‘b’ and ‘c’ with at-most one ‘b’ and two ‘c’s allowed.
- Time : O(1)
- Space : O(1)
c++
1 | long long int countStr(long long int n){ |