Whats the most efficient pythonic way to do this :
<p>I've a list <code>L</code> of size <code>N</code> where each element of the list is between <code>0</code> to <code>K-1</code>.<br>
I want to create a 2D list <code>S</code> with <code>K</code> rows such that <code>r</code><sup>th</sup> row contains all those indices <code>i</code>, such that <code>L[i] == r</code>. </p>

<p>For example if <code>L</code> was <code>[0, 0, 1, 3, 0, 3]</code><br>
then the new list <code>S</code> is <code>[[0, 1, 4], [2], [], [3, 5]]</code></p>

<p>Solution should of course be O(N), it should also be as efficient as possible (Read : no useless append operations on list)</p>
