Java Solution using Trie
Complexity\n- Time complexity:O(n + m * k)\n    \'k\' is the number of words in the input array\n Add your time complexity here, e.g. O(n) \n\n- Space complexit
# Complexity\n- Time complexity:O(n + m * k)\n    \'k\' is the number of words in the input array\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Node{\n    Node[] children;\n    boolean eow;\n\n    public Node(){\n        children = new Node[26];\n        for(int i=0; i<26; i++){\n            children[i] = null;\n        }\n        eow = false;\n    }\n}\nclass Solution {\n    Node root = new Node();\n    String ans = "";\n    public void insert(String word){\n        Node curr = root;\n        for(int i=0; i<word.length(); i++){\n            int index = word.charAt(i) - \'a\';\n\n            if(curr.children[index] == null){\n                curr.children[index] = new Node();\n            }\n\n            if(i == word.length() - 1){\n                curr.children[index].eow = true;\n            }\n            curr = curr.children[index];\n        }\n    }\n\n    public void helper(Node root, StringBuilder temp){\n        if(root == null){\n            return;\n        }\n\n        for(int i=0; i<26; i++){\n            if(root.children[i] != null && root.children[i].eow == true){\n                temp.append((char)(i+\'a\'));\n\n                if(temp.length() > ans.length()){\n                    ans = temp.toString();\n                }\n\n                helper(root.children[i], temp);\n\n                temp.deleteCharAt(temp.length() - 1);\n            }\n        }\n    }\n\n    public String longestWord(String[] words) {\n\n        for(int i=0; i<words.length; i++){\n            insert(words[i]);\n        }\n\n        StringBuilder sb = new StringBuilder();\n\n        helper(root, sb);\n\n        return ans;    \n    }\n}\n```
['Backtracking', 'Trie', 'Java']