title: Find three numbers appeared only once
body: <p>In a sequence of length n, where n=2k+3, that is there are k unique numbers appeared twice
  and three numbers appeared only once. </p>
  
  <p>The question is: <strong>how to find the three unique numbers that appeared only once?</strong></p>
  
  <p>for example, in sequence 1 1 2 6 3 6 5 7 7 the three unique numbers are 2 3 5.</p>
  
  <p>Note:
  3&lt;=n&lt;1e6 and the number will range from 1 to 2e9</p>
  
  <p>Memory limits: 1000KB , this implies that we can't store the whole sequence.</p>
  
  <p><strong>Method I have tried(Memory limit exceed)：</strong></p>
  
  <p>I initialize a tree, and when read in one number I try to remove it from the tree, if the
   remove returns false(not found), I add it to the tree. Finally, the tree has the three numbers. It works, but is Memory limit exceed.</p>
  
  <p>I know how to find one or two such number(s) using bit manipulation. So I wonder if</p>
  
  <p>we can find three using the same method(or some method similar)?</p>
  
  <p><strong>Method to find one/two number(s) appeared only once:</strong></p>
  
  <p>If there is one number appeared only once, we can apply XOR to the sequence to find it.</p>
  
  <p>If there are two, we can first apply XOR to the sequence, then separate the sequence into 2
  parts by one bit of the result that is 1, and again apply XOR to the 2 parts, and we will find the answer.</p>