New York Times interview question

Basic String deduplication and sorting algorithms.