Data Structures & AlgorithmsModerateTCS NQT · bit operations

Problem: What is the Hamming distance between 1011 and 1101 in binary?

  1. A. 1
  2. B. 2
  3. C. 3
  4. D. 4

Correct answer: B. 2

The strings differ in the second and third positions: 1011 vs 1101 gives differences at positions 2 and 3.

More Coding Interview Problems questions

Exams that ask this topic