WLJS LogoWLJS Notebook

HammingDistance

HammingDistance[u, v] gives the Hamming distance between strings or vectors u and v (the number of positions at which they differ).

Examples

Distance between strings:

HammingDistance["karolin", "kathrin"]
(* 3 *)

Distance between lists:

HammingDistance[{1, 0, 1, 1}, {1, 1, 1, 0}]
(* 2 *)

Please visit the official Wolfram Language Reference for more details.

On this page