title: XOR of values present in subset of array
body: <p>Given an array of A of size n containing only positive integers. Let l be the largest number in array A. Generate an array B of size 0 to l such that B[j] is the size of largest subset of array A whose XOR value is equal to j.</p>
  
  <p>Constraints:
  Size of the array A can be from 1 to 10000.
  Elements in array A can range from 1 to 1000.</p>
  
  <p>For example: If array A has (1,2,3,4) then array B would be generated as below.</p>
  
  <p>B(0)=3 as the largest subset having XOR value 0 is (1,2,3)  and has size 3.</p>
  
  <p>B(1)=2 as the largest subset having XOR value 1 is (2,3)  and has size 2.</p>
  
  <p>B(2)=2 as the largest subset having XOR value 2 is (1,3)  and has size 2.</p>
  
  <p>B(3)=2 as the largest subset having XOR value 3 is (1,2)  and has size 2.</p>
  
  <p>B(4)=4 as the largest subset having XOR value 4 is (1,2,3,4)  and has size 4.</p>
  
  <p>My brute-force approach: Generate all non empty subsets of array A and calculate XOR of each subset and save maximum size subset having XOR value j in B[j]. </p>
  
  <p>Is there a more efficient approach to do this?</p>