Alien Dictionary (LC #269) determines character order from sorted alien words. Compare adjacent words to find ordering constraints: the first differing character in word comes before that character in word . Build a directed graph of these constraints. Topological sort gives a valid ordering. If there's a cycle, no valid ordering exists. If a word is a prefix of the previous word but longer, return empty (invalid input). This runs in where is total characters. Use Kahn's algorithm or DFS for topological sort.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/meta-interview-prep/graphs/alien-dictionary
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████████████████████████████████████████████████████████████████████████