Editorial for DMOPC '15 Contest 4 P1 - Dictionary


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Split the words into buckets based on their starting letter, then sort each bucket lexicographically. Most languages have a built-in sorter, so just check if the first letter of adjacent elements are the same.

Time Complexity: \mathcal{O}(N \log N)


Comments

There are no comments at the moment.