Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Problem 2244. Compute hamming distance between two binary vectors represented using lists of 1-byte numbers

Created by Ryszard Maciol

Let v and u be vectors of the same size with 8-bit integers (0-255). We want to compute the number of bits where those vectors differs i.e. a Hamming distance between vectors formed by concatenation of binary representations of those numbers. For example:

v = [1 0]
u = [1 255] 

Binary representations:

v_bin = [00000001 00000000]
u_bin = [00000001 11111111]

And the Hamming distance:

d = 0 + 8 = 8

Problem Group

Solution Statistics

24 correct solutions 14 incorrect solutions
Last solution submitted on Feb 10, 2016

Problem Comments