title: Algorithm - minimal number of bits to distinguish a set of given binary numbers
body: <p>Say that we are given <code>K</code> different binary numbers, each with length <code>N</code> (<code>N</code> can be large). Is there an efficient algorithm to determine the minimal number of bits it needs to distinguish these numbers from each other?</p>
  
  <p>For example:</p>
  
  <p>Given <code>110</code> and <code>011</code>, we only have to check the first (or the last) bit to distinguish them, so the minimal number is <code>1</code>.</p>
  
  <p>Given <code>1000</code>, <code>0100</code>, <code>0010</code> and <code>0001</code>, we need to check at least three bits to distinguish, so the minimal number is <code>3</code>.</p>
  
  <p>Given <code>0000</code>, <code>0100</code>, <code>1000</code> and <code>1100</code>, we only have to check the first two bits, so the minimal number is <code>2</code>.</p>
  
  <p>Follow-up: output the corresponding indexes to be checked.</p>
  
  <hr>
  
  <p>Edit: Assuming these binary numbers are represented as <code>a<sub>1</sub>[0,1,&hellip;,N-1]</code>, &hellip;, <code>a<sub>K</sub>[0,1,&hellip;,N-1]</code>. This problem is equivalent to finding the minimal subsequence <code>[i,j,&hellip;,m]</code> of <code>[0,1,&hellip;,N-1]</code> so that <code>a<sub>1</sub>[i,j,&hellip;,m]</code>, &hellip;, <code>a<sub>K</sub>[i,j,&hellip;,m]</code> are different numbers.</p>