  We give a quantum algorithm to exactly solve certain problems in
combinatorial optimization, including weighted MAX-2-SAT as well as problems
where the objective function is a weighted sum of products of Ising variables,
all terms of the same degree $D$; this problem is called weighted
MAX-E$D$-LIN2. We require that the optimal solution be unique for odd $D$ and
doubly degenerate for even $D$; however, we expect that the algorithm still
works without this condition and we show how to reduce to the case without this
assumption at the cost of an additional overhead. While the time required is
still exponential, the algorithm provably outperforms Grover's algorithm
assuming a mild condition on the number of low energy states of the target
Hamiltonian. The detailed analysis of the runtime dependence on a tradeoff
between the number of such states and algorithm speed: fewer such states allows
a greater speedup. This leads to a natural hybrid algorithm that finds either
an exact or approximate solution.
