title: Bitwise AND of a series of random numbers (efficiency)
body: <p>Given a series of random numbers in an array, e.g.: <code>147, 95, 254, 78, 66, 120</code>, how do I find the result of operands from index <code>n</code> to index <code>m</code> when they're <code>&amp;</code>ed (bitwise &amp;) efficiently?</p>
  
  <p>For example:</p>
  
  <p><code>n = 2</code> and <code>m = 5</code>. This means you have to <code>&amp;</code> the numbers in the array from the second element (<code>95</code>) until the fifth element (<code>66</code>).</p>
  
  <p>I don't know how other than to just <code>&amp;</code> them one by one, but this isn't efficient. The question I'm working with has multiple queries, meaning that with one series of random numbers (for example the above), the question may ask multiple times the <code>&amp;</code> result of the numbers from the <code>n</code> element until the <code>m</code> element with each query containing a different value of <code>n</code> and <code>m</code>.</p>
  
  <hr>
  
  <p><strong>EDIT</strong>: I've tried doing the following: change all the numbers into binary bits and store all the bits in deques. Afterwards, check if one of the bits are 0 in the given range, and if there is one 0, then said bit returns 0 value. I did get a correct answer. However, it's still not efficient enough. <a href="https://gist.github.com/TakeNoteIAmHere/3e408c9d94d24447076cb82d81966113" rel="nofollow noreferrer">Here</a> is my code</p>