Sha256: 59ca9b92b8f5611410c97c626d371e555d912eec1af218e8e7853f24b9476f1d

Contents?: true

Size: 218 Bytes

Versions: 97

Compression:

Stored size: 218 Bytes

Contents

local Hamming = {}

function Hamming.compute(a,b)
  local distance = 0
  for i = 1, a:len() do
    if (a:sub(i, i) ~= b:sub(i, i)) then
      distance = distance + 1
    end
  end
  return distance
end

return Hamming

Version data entries

97 entries across 97 versions & 1 rubygems

Version Path
trackler-2.0.6.1 tracks/lua/exercises/hamming/example.lua
trackler-2.0.6.0 tracks/lua/exercises/hamming/example.lua
trackler-2.0.5.18 tracks/lua/exercises/hamming/example.lua
trackler-2.0.5.17 tracks/lua/exercises/hamming/example.lua
trackler-2.0.5.16 tracks/lua/exercises/hamming/example.lua
trackler-2.0.5.15 tracks/lua/exercises/hamming/example.lua
trackler-2.0.5.14 tracks/lua/exercises/hamming/example.lua
trackler-2.0.5.13 tracks/lua/exercises/hamming/example.lua
trackler-2.0.5.12 tracks/lua/exercises/hamming/example.lua
trackler-2.0.5.11 tracks/lua/exercises/hamming/example.lua
trackler-2.0.5.10 tracks/lua/exercises/hamming/example.lua
trackler-2.0.5.9 tracks/lua/exercises/hamming/example.lua
trackler-2.0.5.8 tracks/lua/exercises/hamming/example.lua
trackler-2.0.5.7 tracks/lua/exercises/hamming/example.lua
trackler-2.0.5.6 tracks/lua/exercises/hamming/example.lua
trackler-2.0.5.5 tracks/lua/exercises/hamming/example.lua
trackler-2.0.5.4 tracks/lua/exercises/hamming/example.lua
trackler-2.0.5.3 tracks/lua/exercises/hamming/example.lua
trackler-2.0.5.2 tracks/lua/exercises/hamming/example.lua
trackler-2.0.5.1 tracks/lua/exercises/hamming/example.lua