title: Number of bits set in given bitsets at an index
body: <p>Given n bitsets , generate a new bitset in which a bit is set at an index , if atleast k out on n bitset has there bit set at that index. </p>
  
  <p>n bitset can vary in size. The size is &lt;= 10<sup>8</sup></p>
  
  <p><strong>Example</strong>:</p>
  
  <pre><code>n = 3 , k =2
  10001
  00101
  10001
  New Bitset : 10001
  </code></pre>
  
  <p>1.<strong>First Approach</strong> : </p>
  
  <pre><code> len = Max size from n bitsets  
   n = number of bitsets 
   n bitsets = List&lt;Bitset&gt; bitsets
   Bitset newBitset = new Bitset(len);
   int count = 0;
   for(int i = 0; i &lt; len; i++){
          count = 0;
          for(Bitset b : bitsets){
              if(b.size() &gt; i &amp;&amp; b.get(i)){
                  count++;
              }
          }
          if(count &gt;= k){
              newBitset.set(i);
          }
    }
    // Complexity = O(len*n)
  </code></pre>
  
  <p>2. <strong>Second Approach</strong>:
      We can take nCk combinations of bitsets , take AND of each and
      finally take OR of resulting bitsets to get the required bitset.</p>
  
  <p>I am looking for more optimised solution. </p>