title: Finding three numbers occurring even number of times in an array
body: <p>In an array except three numbers all numbers occur odd number of times. How to find all three numbers occurring even number of times in an array?</p>
  
  <p>I can get till a point where I have xor of all three even occurring numbers. How to get the three numbers from that xor value? My approach till now:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;set&gt;
  using namespace std;
  
  int main() {
      // Find the 3 numbers occuring even times in an array
      int arr[] = {1,6,2,88,34,4,98,25,61,7,2,78,2,78,8,25,9,34,56,331};
      int a = arr[0];
  
      for (int i=1;i&lt;20;i++)
           a ^= arr[i];
  
      set&lt;int&gt; myset;
      myset.insert(arr,arr+20);
      set&lt;int&gt;::iterator it;
      for (it=myset.begin(); it!=myset.end(); ++it)
          a ^= *it;
  
      cout&lt;&lt;a&lt;&lt;endl; // a stores xor of the three numbers occuring even number of times, i.e., (25^78^34)=117
      return 0;
  }
  </code></pre>
  
  <p>Note: Hashtable and sorting should not be used. The solution should be in O(n) time.</p>