Dsa
Graphs Dfs
Medium
Alien Language Dictionary
You are given a list of words sorted lexicographically in an alien language. Each word consists of lowercase English letters. Your task is to deduce the order of the letters in this alien language. Return the order of characters as a string. The input format is as follows:
Input:
- First line: an integer n (1 ≤ n ≤ 100) - number of words.
- Next n lines: the words themselves - each consists of only lowercase English letters and has a length between 1 and 100.
Output:
- A string representing the order of characters.
Example:
Input:
3
wrt
wrf
er
Output:
wert
Key concepts
graphsdfstopological_sort
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now