Question bank › Bit Manipulation
Dsa Bit Manipulation Hard

Find Different Bits Count

Given two integers `a` and `b`, calculate the number of bits that are different between them (Hamming distance). Your function should read these two integers and output their Hamming distance. Example: Input: 4 1 Output: 2 // Explanation: 4 in binary is 100 and 1 is 001. The bits at positions 0 and 2 are different, so the Hamming distance is 2.

Key concepts

bit_manipulationhamming_distance

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.