Sha256: 016d096b8d3b70ece23d661d53d9951c73c7d3636e724394e19e8abc7992d01f
Contents?: true
Size: 371 Bytes
Versions: 240
Compression:
Stored size: 371 Bytes
Contents
function Hamming() {} Hamming.prototype.compute = function (strand1, strand2) { if (strand1.length !== strand2.length) { throw new Error('DNA strands must be of equal length.'); } var distance = 0; for (var i = 0; i < strand1.length; i++) { if (strand1[i] !== strand2[i]) { distance++; } } return distance; }; module.exports = Hamming;
Version data entries
240 entries across 240 versions & 1 rubygems