Python with Trie and sort
\nclass TrieNode(object):\n    def __init__(self):\n        self.children = {}\n        self.end = False\n\nclass Solution(object):\n    def longestWord(self, w
```\nclass TrieNode(object):\n    def __init__(self):\n        self.children = {}\n        self.end = False\n\nclass Solution(object):\n    def longestWord(self, words):\n        self.root = TrieNode()    \n        words = sorted(set(words), key = lambda word:(-len(word), word))\n        for word in words:\n            cur = self.root\n            for letter in word:\n                if letter not in cur.children:\n                    cur.children[letter] = TrieNode()\n                cur = cur.children[letter]\n            cur.end = True\n        for word in words:\n            flag = True\n            cur = self.root\n            for letter in word:\n                if cur.children[letter].end == False:\n                    flag = False\n                    break\n                else:\n                    cur = cur.children[letter]\n            if flag:\n                return word\n        return \'\'\n            \n        \n```
['Trie', 'Sorting', 'Python3']