4 ms·
The linked c code sample sorts the array, then accumulates the unique elements in a single pass. The python code sample makes a separate pass over `unique` for
by hither_shores 4y ago
The linked c code sample sorts the array, then accumulates the unique elements in a single pass. The python code sample makes a separate pass over `unique` for every element of `items`.
- Genmutant 4y agoThe python code also prints the resulting list in the same order. It's a completely different problem to solve. In python I would throw the list in a set and return the size of it / print that.