Cody

# Problem 2303. Compute Hamming distances between each pair of rows from two input matrices

Solution 442259

Submitted on 13 May 2014 by Alfonso Nieto-Castanon
• Size: 35
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% test 0 q = [0 0]; db = [0 0 0 0]; hamming_distances = [0 0]; assert(isequal(hammings(q, db), hamming_distances ));

2   Pass
%% test 1 q = 128; db = 4; hamming_distances = 2; assert(isequal(hammings(q, db), hamming_distances ));

3   Pass
%% test 2 q = [ 0 0 0 128 128 0]; db = [128 255 0 0 0 0]; hamming_distances = [2 9 1; 2 9 1; 1 8 0]; assert(isequal(hammings(q, db), hamming_distances ));

4   Pass
%% test 3 q = [128 128]; db = [255 0 255 0]; hamming_distances = [14 2]; assert(isequal(hammings(q, db), hamming_distances));

5   Pass
%% test 4 q = [ 0 0 0 128 128 0]; db = [128 255 0 0]; hamming_distances = [2 9; 2 9; 1 8]; assert(isequal(hammings(q, db), hamming_distances ));

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!