title: Invert list of lists of indices
body: <p>I have a list of lists of indices, e.g.,</p>
  
  
  
  <pre><code>a = [
      [2],
      [0, 1, 3, 2],
      [1],
      [0, 3]
      ]
  </code></pre>
  
  <p>I'd now like to "invert" this list: The number <code>0</code> appears at indices <code>1</code> and <code>3</code>, so:</p>
  
  
  
  <pre><code>b = [
      [1, 3],
      [1, 2],
      [0, 1],
      [1, 3]
      ]
  </code></pre>
  
  <p>Any hints on how to do that fast? (The lists I'm dealing with are potentially large.)</p>
  
  <p><em>Bonus:</em> I know that each index appears exactly twice in <code>a</code> (just like in the above example).</p>