Dsa
Bit Manipulation
Medium
Unique Binary Sequence
You are given an integer `n`. Generate all unique binary sequences of length `n` that do not contain consecutive `1`s. Print the total number of such sequences.
Input:
A single integer `n` (1 ≤ n ≤ 30).
Output:
A single integer representing the count of unique binary sequences.
Example:
Input:
3
Output:
5
Explanation: The unique binary sequences of length 3 without consecutive 1's are: 000, 001, 010, 100, 101.
Key concepts
bit_manipulationbinaryunique
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now