Hacker News new | ask | show | jobs
by eridius 4354 days ago
The only difference is I sort before uniquing, but the python code uniques before sorting. But the result is identical (and in shell scripting, you can't unique without sorting first).

Although FWIW I just checked and the `sort` tool actually has a flag for uniquing during the sort. I don't know if that's portable though.

1 comments

Yes. Pedantically speaking his solution may be faster for the pathological case of the input consisting almost entirely of duplicates.