title: 2sum with duplicate values
body: <p>The classic 2sum question is simple and well-known: </p>
  
  <p>You have an unsorted array, and you are given a value S. Find all pairs of elements in the array that add up to value S. </p>
  
  <p>And it's always been said that this can be solved with the use of HashTable in <code>O(N)</code> time &amp; space complexity or <code>O(NlogN)</code> time and <code>O(1)</code> space complexity by first sorting it and then moving from left and right, </p>
  
  <p>well these two solution are obviously correct BUT I guess not for the following array :</p>
  
  <p><code>{1,1,1,1,1,1,1,1}</code> </p>
  
  <p>Is it possible to print ALL pairs which add up to 2 in this array in <code>O(N)</code> or <code>O(NlogN)</code> time complexity ?</p>