We will consider the distance between two bit lines equal to the number of positions in which the bit values of these lines are different. For example, the distance between lines 10001 and 11011 is two, and between lines 10001 and 01010 - four. It is required to split a given array of strings into the maximum possible number of clusters so that the distance between rows from different clusters is at least three. Input file format: on the first line - the number of bit lines n and the number of bits in line m separated by a space; on each of the next n lines there is a bit string specified by a sequence of m zeros and ones (see the examples on the links above). The algorithm should calculate the number of clusters, the clusters themselves should not be returned.
Tell me the approach to solving the problem? How to effectively solve?