Question bank › Bit Manipulation
Dsa Bit Manipulation Medium

Submask Count

Given an integer N, write a program to count how many submasks (subsets of bits) can be formed with its set bits. Each unique arrangement of set bits should count as a different mask. Input format: - The first line contains an integer N (0 <= N <= 10^9). Output format: - Print a single integer indicating the number of unique submasks. Example: Input: 5 Output: 8 (5 in binary is 101, which has two set bits; the possible unique subsets of those bits is 2^2 = 4)

Key concepts

bit_manipulationcombinatorics

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.