程序媛詹妮弗
终身学习

There is a new alien language which uses the latin alphabet. However, the order among letters are unknown to you. You receive a list of non-empty words from the dictionary, where words are sorted lexicographically by the rules of this new language. Derive the order of letters in this language.

Example 1:

Input:
[
  "wrt",
  "wrf",
  "er",
  "ett",
  "rftt"
]

Output: "wertf"

 

题目

给定一组单词,已知这些单词的排列顺序是符合某种奇怪的字典序的。请求出这种字典序下各个字母的排列顺序,对于存在多种答案者,给出任一即可。

思路

代码

posted on 2018-10-19 15:52  程序媛詹妮弗  阅读(192)  评论(0编辑  收藏  举报