title: Given 3 sorted arrays A, B, C and number S, find i, j, k such that A[i] + B[j] + C[k] = S
body: <p>I've just found out how to solve this in <code>O(n^2 log n)</code> time (assuming each array has the same length):</p>
  
  <pre><code>for each A[i]:
    for each B[j]:
      if A[i] + B[j] + C.binarySearch(S - A[i] - B[j]) == S:
         return (i, j, k)
  </code></pre>
  
  <p>Is there any way to solve this in <code>O(n^2)</code> time or to improve the above algorithm?</p>