Given a list of words, arrange them in such a way that when combined they form the word which comes at the end of the dictionary formed by every possible arrangement.
Example: Input: ["d", "fa"]
Output: ["fa", "d"]
Explanation: All the possible words formed by combining all the words are "fad" and "dfa". When arranged in a dictionary, the word "Ida" will come last in the dictionary. Input: ["je", "r", "yl Output: ["y", "rr", "je"] Explaination: All possible words for by combining all the words are "jerry", "jeyrr", "rrjey", "yjerr", "rryje", and "yrrje". When arranged in a dictionary the word "yrrje" will come last in the dictionary. I Expected Time Complexity: O(nLog(n)) Expected Space Complexity: 0(1) n = number of words in the list.
Answers
Answered by
0
Answer:
hiiii how are you are you Bengali
Similar questions