eolymp
bolt
Try our new interface for solving problems
Problems

Hamming Distance

Hamming Distance

The Hamming distance between two strings $a$ and $b$ of equal length is the number of positions where the strings differ. You are given $n$ bit strings, each of length $k$ and your task is to calculate the minimum Hamming distance between two strings. \InputFile The first line has two integers $n\:(2 \le n \le 2 ⋅ 10^4)$ and $k\:(1 \le k \le 30)$: the number of bit strings and their length. Then there are $n$ lines each consisting of one bit string of length $k$. \OutputFile Print the minimum Hamming distance between two strings.
Time limit 1 second
Memory limit 128 MiB
Input example #1
5 6
110111
001000
100001
101000
101110
Output example #1
1