Dsa
Bit Manipulation
Medium
Unique Bit Sequence Counter
You are given an integer n, and your task is to determine how many unique binary sequences can be formed using exactly n bits. Implement a function to return the count of these unique sequences. For this question, assume that sequences are unique if their binary representations are different, even if the actual integer values are the same.
Input:
A single integer n (0 ≤ n ≤ 30).
Output:
An integer representing the number of unique sequences.
Example:
Input:
3
Output:
8
Key concepts
bit_manipulationcounting
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