Question bank › Bit Manipulation
Dsa Bit Manipulation Medium

Count Unique Bits

You are given a positive integer n. Your task is to find how many unique bits (1s) are present in its binary representation. For example: Input: 12 Output: 2 Explanation: The binary representation of 12 is 1100, which has two unique bits (1s).

Key concepts

bit manipulationcountingbinary

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.