Asymptotically optimal way to find the sum of three elements of an array closest to a given number

Viewed 3345

In his answer to this question, John Feminella says:

It's possible to do this sub-quadratically if you get really fancy, by representing each integer as a bit vector and performing a fast Fourier transform, but that's beyond the scope of this answer.

What is the asymptotically optimal way of solving the problem described in that question?

1 Answers
Related