Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Solution: Alien Dictionary

Problem Statement

There is a dictionary containing words from an alien language for which we don’t know the ordering of the letters.

Given a list of strings words from the alien language's dictionary. All strings in words are sorted lexicographically by the rules of this new language.

Return a string of the unique letters in the new alien language sorted in lexicographically increasing order by the new language's rules.

It is given that the input is a valid dictionary and there exists an ordering among its letters.

Example 1:

.....

.....

.....

Like the course? Get enrolled and start learning!