---
title: Binary Closest String Problem
url: https://www.emergentmind.com/topics/binary-closest-string-problem
type: topic
---

# Binary Closest String Problem

The Binary Closest String Problem is the minimax center problem over Hamming space on the alphabet $\{0,1\}$. Given a finite set of equal-length binary strings $X \subseteq \{0,1\}^L$, the task is to find a binary string $y \in \{0,1\}^L$ minimizing the maximum Hamming distance to the strings in $X$, that is, to compute
$$
d^*=\min_{y\in\{0,1\}^L}\max_{x\in X} d_H(y,x).
$$
The problem is also referred to as the string center problem or string consensus problem, although the latter label can be misleading because some literature uses “consensus” for sum-of-distances objectives rather than the minimax objective considered here [2305.16878]. In the binary setting, Hamming distance coincides with Manhattan distance, so Binary Closest String is a special case of Manhattan Sequence Consensus [1407.6144]. Contemporary work on the problem spans exact exponential algorithms, fine-grained lower bounds, fixed-parameter tractability, LP/IP/CSP formulations, dynamic data structures, and quantum algorithms [2605.31417].

## 1. Formal definition and problem variants

For binary strings $x,y\in\{0,1\}^L$, the Hamming distance is
$$
d_H(x,y)=|\{i\in[L]:x[i]\neq y[i]\}|,
$$
and a Hamming ball of radius $R$ around $x$ is $\{y\in\{0,1\}^L:d_H(x,y)\le R\}$ [2305.16878]. The optimization problem asks for a center whose smallest enclosing Hamming ball contains all input strings.

Two standard variants are distinguished in fine-grained analyses. In the **continuous** version, the center may be any string in $\{0,1\}^L$. In the **discrete** version, the center is required to belong to the input set itself [2305.16878]. The discrete variant is polynomial-time solvable by exhaustive pairwise distance computation, but its exact complexity depends sharply on the relationship between the number of strings and the dimension.

A natural dual is the **Remotest String** problem. In the continuous binary case, it maximizes $\min_{x_i\in X} d_H(y,x_i)$ over all $y\in\{0,1\}^L$; in the discrete case it maximizes the minimum distance to the other input strings [2305.16878]. For binary alphabets, continuous Closest String and continuous Remotest String are equivalent via complementation:
$$
d_H(x,y)=L-d_H(\bar y,x),
$$
hence
$$
\min_{x\in\{0,1\}^L}\max_{y\in X} d_H(x,y)=L-\max_{x\in\{0,1\}^L}\min_{y\in X} d_H(x,y).
$$
This binary-specific equivalence is central in several lower-bound transfers [2305.16878].

The problem also has a standard parameterized decision form: given $X$ and an integer $d$, decide whether there exists a center $y$ with $\max_{x\in X} d_H(y,x)\le d$ [2605.31417]. This decision version underlies most FPT algorithms and most exact lower bounds parameterized by the optimum radius.

## 2. Complexity landscape and conditional barriers

The exact minimax Closest String Problem is NP-hard, and the binary minimax version is NP-complete [0705.0561]. The classical exhaustive baselines are immediate. For the continuous binary problem, enumerating all $2^L$ candidate centers and evaluating their radii gives time $O(2^L\cdot m\cdot L)$ for $m=|X|$ [2305.16878]. For the discrete problem, computing all pairwise Hamming distances and taking row maxima gives time $O(m^2\cdot L)$ and space $O(m^2)$ if all distances are stored [2305.16878].

Recent fine-grained results identify a sharp dichotomy between the continuous and discrete versions. For the continuous binary problem, exhaustive search is conditionally optimal: there is no exact algorithm with running time $O(2^{(1-\epsilon)L}\operatorname{poly}(m,L))$ for any $\epsilon>0$ unless SETH fails [2305.16878]. In the discrete problem, a different barrier appears. When the dimension lies in the regime $\omega(\log m)<L<m^{o(1)}$, the exact complexity is conditionally quadratic, $m^{2\pm o(1)}$, under the Hitting Set Conjecture [2305.16878]. The same hard range transfers to binary discrete Remotest String through a reduction that preserves $m$ up to constant factors and increases dimension by only $O(\log m)$ [2305.16878].

Parameterized by the optimum radius $d=d^*$, a second barrier is known. A 2026 result gives a randomized exact algorithm with running time $O^*(4^d)$ and proves that no $O^*((4-\epsilon)^d)$-time algorithm exists for any constant $\epsilon>0$ unless SETH fails [2605.31417]. The lower bound is obtained by inspecting fine-grained hard instances where the optimal radius satisfies $d=(1/2\pm o(1))\cdot L$, together with a padding argument extending the conclusion to all $d\le L/2$ [2605.31417].

Approximation schemes are also tightly constrained. Although PTASes for Closest String are known, there is no EPTAS unless $\mathrm{FPT}=\mathrm{W}[1]$ [1509.05809]. More quantitatively, for any computable $f$, a PTAS with runtime $f(\varepsilon)\cdot n^{o(1/\varepsilon)}$ would contradict ETH, and this lower bound already holds over the binary alphabet [1509.05809]. A plausible implication is that the binary problem is unusual in combining strong positive approximation results with unusually rigid barriers on the $\varepsilon$-dependence.

## 3. Exact algorithms across parameter regimes

Three exact regimes dominate the modern algorithmic picture: exponential search in the string length, subquadratic exact algorithms for restricted discrete regimes, and FPT algorithms parameterized by the optimum radius.

For the continuous binary problem, the exact situation is stark. The trivial $O(2^L\cdot \operatorname{poly}(m,L))$ enumeration is essentially best possible under SETH [2305.16878]. This rules out meet-in-the-middle-like exact speedups in the exponent and makes the continuous binary problem a canonical example of exhaustive-search optimality in fine-grained complexity.

For the discrete problem, exact improvements are possible outside the HSC-hard range. In the small-dimension regime $L=o(\log m)$, there is an exact $O(m\cdot 2^L)$ algorithm based on a novel use of inclusion–exclusion [2305.16878]. Its key identity rewrites the indicator of bounded Hamming distance in terms of coordinate-subset agreement, allowing preprocessing of counts
$$
T[x,I]=|\{y\in X:x[I]=y[I]\}|
$$
for all subsets $I\subseteq[L]$, followed by radius tests through alternating sums over subset sizes [2305.16878]. The algorithm runs in $O(m\cdot 2^L)$ time and uses $O(m\cdot 2^L)$ words of memory; it becomes subquadratic whenever $2^L=o(m)$ [2305.16878].

In the large-dimension regime $L=m^\delta$ for any fixed $\delta>0$, exact discrete Closest String can be solved in $O(m^{2+\delta-\epsilon})$ time for some $\epsilon=\epsilon(\delta)>0$ by computing all pairwise Hamming distances faster than $O(m^2L)$ via heavy–light splitting and fast matrix multiplication [2305.16878]. The construction forms a sparse binary indicator matrix $A$ with
$$
D=L\cdot \mathbf 1-A A^\top,
$$
then handles heavy columns by fast MM and light columns by sparse accumulation [2305.16878]. This yields a polynomial improvement over the brute-force $O(m^2L)$ baseline.

The parameterized landscape has undergone a long sequence of base improvements. For Binary Closest String parameterized by the optimum radius $d$, the progression reported in 2026 is
$$
O^*(d^d)\rightarrow O^*(16^d)\rightarrow O^*(9.513^d)\rightarrow O^*(8^d)\rightarrow O^*(6.731^d)\rightarrow O^*(5^d)\rightarrow O^*(4^d),
$$
with the $O^*(4^d)$ algorithm being conditionally optimal under SETH [2605.31417]. Its procedure is remarkably simple: start from an arbitrary input string, repeatedly select a farthest string $x$, and if $d_H(x,y)>d$, flip one uniformly random disagreement bit of the current center $y$ toward $x$ [2605.31417]. The analysis tracks the state $i=d_H(y,y^*)$ relative to a fixed optimum $y^*$ and proves a progress probability
$$
p_i=\min\{i/(2d),1/2\},
$$
leading to an expected bound of at most $4^d\cdot L^2$ iterations and overall running time $O^*(4^d)$ [2605.31417]. With a reset rule triggered when the farthest distance exceeds $2d$, the polynomial factor can be improved to $O(m|X|+4^d d^2 |X|)$ [2605.31417].

## 4. Structural special cases and small-number-of-strings regimes

A distinct exact line of work studies instances with a small number of input strings. In the Manhattan Sequence Consensus framework, which subsumes Binary Closest String, there is an $O(\ell)$-time exact algorithm for $k\le 5$ sequences of length $\ell$ [1407.6144]. For binary strings, this immediately yields an $O(\ell)$ algorithm for the minimax closest string problem with at most five inputs.

The method is column-based. For each position, the $k$ input symbols are sorted, interval systems are defined over adjacent ranks, and the global objective is converted into a constrained ILP with a single radius variable [1407.6144]. Two algebraic reductions are then applied: sign normalization by negation of variables, and merging of variables with identical coefficient vectors by Minkowski summation of their ranges. For general $k$, this reduces the number of variables to at most $2^{k-1}$; for $k\le 5$, the paper proves a much stronger combinatorial classification [1407.6144].

For $k=5$, every optimal sum-MSC sequence belongs to one of 20 families: five border families $B_i$, five middle families $M_i$, and ten triangle families $T_\Delta$ [1407.6144]. Each family induces an interval system whose ILP reduces to an “easy ILP” with at most four variables, solvable in $O(1)$ amortized time after linear-time preprocessing over columns [1407.6144]. The overall algorithm constructs the 20 candidates, solves their reduced ILPs, and selects the minimum radius.

The same paper gives a kernelization for general parameter $k$. By merging columns with identical permutation types, any instance reduces in linear time to length at most $k!$, and in the binary case, with appropriate tie-breaking, to length at most $2^k$ [1407.6144]. This shows fixed-parameter tractability in the number of strings, although the resulting generic exact algorithm is considered impractical beyond very small $k$ because naive enumeration over interval systems remains too large [1407.6144].

This small-$k$ regime is structurally different from the fine-grained large-$m$ regime. A plausible implication is that Binary Closest String supports two orthogonal exact methodologies: parameterization by the optimum radius, and parameterization by the number of strings through combinatorial column types.

## 5. Mathematical formulations and solver frameworks

Several exact and near-exact frameworks formulate Binary Closest String as IP, LP, CSP, or QUBO. These formulations emphasize different aspects of the problem: certification, propagation, practical heuristics, or hardware embedding.

An IP formulation introduces binary center variables and mismatch variables. In one-hot form, $x_{a,j}\in\{0,1\}$ indicates that position $j$ of the center uses symbol $a$, and the objective minimizes a radius variable $D$ subject to one-hot constraints and distance upper bounds [0705.0561]. In a binary specialization, one may instead use center bits $s_j\in\{0,1\}$ and mismatch variables $y_{j,i}\in\{0,1\}$ satisfying
$$
y_{j,i}\ge s_j-t^{(i)}_j,\qquad y_{j,i}\ge t^{(i)}_j-s_j,\qquad \sum_j y_{j,i}\le D,
$$
for every input string $t^{(i)}$ [0705.0561]. LP relaxation followed by greedy iterative rounding yields a polynomial-time heuristic that is exact for two strings and has additive error at most one for three binary strings [0705.0561].

A CSP formulation is more explicitly combinatorial. It uses center variables $c_i\in\{0,1\}$, reified mismatch indicators $m_{k,i}=c_i\oplus x_i^{(k)}$, per-string distances $D_k=\sum_i m_{k,i}$, and a radius variable $d=\max_k D_k$ [1005.0089]. Two standard bounds are built in: the Hamming diameter upper bound
$$
HD(S)=\max_{u,v\in S} H(u,v),
$$
and the lower bound
$$
d_{\min}=\left\lceil \frac{HD(S)}{2}\right\rceil
$$
from the triangle inequality [1005.0089]. The paper’s principal heuristic is PWM ordering: positions are searched by decreasing majority count, and the majority bit is tried first. Reported experiments show “several orders of magnitude” speedups over generic orderings at and above the optimal distance, while the dominant residual cost is often certifying infeasibility at $d^*-1$ [1005.0089]. The same framework also supports enumeration of all optimal centers and distributed two-front search that combines optimization from above with infeasibility proofs from below [1005.0089].

A recurrent source of confusion is the distinction between the minimax objective and the sum-of-distances objective. The CSP work explicitly notes that minimizing the sum of Hamming distances is a different objective, outside its scope [1005.0089]. The D-Wave annealing paper makes this distinction operationally important: its QUBO formulations optimize a sum-of-distances proxy, not the max-distance radius directly [2310.12852]. In that formulation, each column uses one-hot variables $\alpha_{x i}$ selecting one observed input symbol for the center, with a clique penalty enforcing exactly one choice and a linear objective coefficient equal to the precomputed number of mismatches induced by that choice [2310.12852]. Because columns do not couple, the QUBO decomposes exactly across columns under that objective, enabling substring batching on Pegasus hardware; the evaluation metric is the Occurrence Ratio
$$
OR_P=\frac{N_P}{\sum_Q N_Q},
$$
and the paper reports recovery of expected solutions on small test cases with minimal hyperparameter tuning [2310.12852].

## 6. Dynamic, approximation, and quantum extensions

Binary Closest String has also been studied in dynamic and quantum models, and these extensions expose which parts of the classical structure are robust under changing computational assumptions.

In the dynamic setting, one maintains a set of $m$ binary strings of fixed length $n$ under point updates $s_i[j]\leftarrow a$ and answers feasibility queries for a fixed radius parameter $d$ [2205.00441]. The binary-specialized data structures have initialization time $2^{O(d)}\cdot m\cdot n$, amortized update time $2^{O(d)}$, and worst-case query time $2^{O(d)}$ [2205.00441]. They maintain an approximate origin string $o$ such that, if the instance is feasible, then $H(o,s_i)\le 8d$ for every string $s_i$; if some string ever exceeds distance $8d$ from $o$, infeasibility is certified [2205.00441]. Random color-coding of mismatch positions then supports a fast “far-pair” negativity check: if two strings are at Hamming distance greater than $2d$, the structure detects this with probability at least $2^{-O(d)}$ [2205.00441]. The resulting Monte Carlo guarantees have no false negatives and false positives of probability at most $2^{-\Omega(d)}$ after standard amplification [2205.00441].

Approximation remains theoretically delicate. The binary problem admits PTASes, but the lower bounds on their runtime dependence imply that high-accuracy approximation cannot be made strongly efficient in the EPTAS sense unless parameterized complexity collapses [1509.05809]. This suggests that, in binary Hamming space, approximation is useful primarily when the classical PTAS exponents are acceptable or when exact FPT algorithms in the optimum radius are inapplicable.

Quantum algorithms split into two main regimes. A nested Dürr–Høyer minimum/maximum search solves binary Closest String in time $O^*(2^{L/2}\sqrt{m})$, and under a quantum analogue of SETH, the dominant $2^{L/2}$ scaling cannot be improved to $2^{(1-\epsilon)L/2}$ for any $\epsilon>0$ [2510.15529]. A second algorithm quantizes the bounded-search tree of Gramm et al. by an MNRS quantum walk and gives a binary Hamming runtime of $O(mL)+O(m^2\cdot d(d+5)/2)$ in the paper’s notation, improving the dominant dependence on the radius parameter from $d^d$ to $d^{d/2}$ relative to the classical branching backbone [2510.15529]. The same work also gives a quantum dynamic-programming algorithm for Levenshtein-distance variants and a quantum-accelerated generator search for binary Closest Substring [2510.15529]. However, the paper explicitly notes that for binary alphabets the best classical fixed-alphabet exact bounds $O(m d\cdot 2^d)$ may outperform the walk-based quantum algorithm once $d>4$ [2510.15529].

Across these directions, the binary case is repeatedly special. Complementation equates Closest and Remotest String in the continuous setting; small alphabets change the parameter tradeoffs in both classical and quantum algorithms; and several lower bounds become strongest precisely over $\Sigma=\{0,1\}$ [2305.16878]. The current exact picture is therefore unusually crisp: exhaustive search is conditionally optimal for the continuous binary problem, the discrete problem admits faster exact algorithms only outside the super-logarithmic hard range, and the radius-parameterized complexity is settled at randomized $O^*(4^d)$ time [2605.31417].

Source: https://www.emergentmind.com/topics/binary-closest-string-problem