In coding theory, the Lee distance is a distance between two strings and of equal length n over the q-ary alphabet {0, 1, …, q − 1} of size q ≥ 2. It is a metric defined as If q = 2 or q = 3 the Lee distance coincides with the Hamming distance, because both distances are 0 for two single equal symbols and 1 for two single non-equal symbols. For q > 3 this is not the case anymore; the Lee distance between single letters can become bigger than 1. However, there exists a Gray isometry between with the Lee weight and with the Hamming weight.