Given is a set S = {s1, …, sm} where each si is a string of length k over the alphabet {0,1,?}.
I am looking for an efficient algorithm solving the following decision problem:
Is it true that for each 1 ≤ a < b ≤ k there is a string si in S s.t. si(a) = 0 and si(b) = 1 or si(a) = 1 and si(b) = 0, where si(a) denotes the a-th character in string si.
I am looking for a sublinear time algorithm in m, so something like O(\sqrt(m)f(k)) would be the goal.
Can’t be done in less than linear time, unless prior offline processing is allowed.
Basically the first string that satisfies your criterion will be the last one you consider. And you might have to consider all m-1 others first.