Alien Alphabet
words is sorted according to an unknown alphabet. Return one valid ordering of all letters that appear. When several letters are available at the same step, choose the smallest in normal English order, so the answer is unique. Return "" if no valid order exists.
Examples
A guided view of the published example, not a trace of your code.
[["wrt","wrf","er","ett","rftt"]]"wertf"Start with the input values shown in this example.
Input: words = ["wrt","wrf","er","ett","rftt"]
Output: "wertf"
Explanation: classic
Input: words = ["z","x"]
Output: "zx"
Explanation: two letters
Input: words = ["z","x","z"]
Output: ""
Explanation: cycle
Hint 1
Compare each adjacent pair of words; the first differing letters give an edge.
Hint 2
A longer word before its own prefix (like 'abc' before 'ab') is invalid.
Hint 3
Topological sort with a min-heap of available letters.