title: Asymptotically optimal way to find the sum of three elements of an array closest to a given number
body: <p>In his answer to <a href="https://stackoverflow.com/questions/2070359/finding-three-elements-in-an-array-whose-sum-is-closest-to-an-given-number">this question</a>, John Feminella says:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>What is the asymptotically optimal way of solving the problem described in that question?</p>