The correct order is: "wertf". -> this is wrong, the correct answer should be "werft", right?
No, it's correct. The first two words are "wrt" and "wrf", which shows that "t" comes before "f".
what about "rftt" -> this indicates f comes before t right?
No, one word alone indicates nothing about order.
"wrt" and "wrf" -> why this indicates t comes before f?
If f came before t, then that list wouldn't be lexicographically sorted.
I originally had the same question as @gocha, then I realized that the sorting happens among the list of words, not within each word. Then the description makes sense.
The line "You may assume that if a is a prefix of b, then a must appear before b in the given dictionary." Is throwing everyone off, including myself. It sounds as if it is talking about a word like "ab", when really I think it means that a and b are two separate words in the dictionary.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.