✔️ | C++ | TRIE + DFS | Easy Solution
Approach\n    Use Trie Data Structure and do dfs to find the count of words that are used to make the current word\n\n# Complexity\n- Time complexity:\n-   O(N^
# Approach\n    Use Trie Data Structure and do dfs to find the count of words that are used to make the current word\n\n# Complexity\n- Time complexity:\n-   O(N^2)\n\n- Space complexity:\n-   O(26*N)\n# Code\n```\n\nstruct Node{\n    bool end = false;\n    Node* next[26] = { NULL };\n};\n\nclass Solution {\npublic:\n    vector<string> findAllConcatenatedWordsInADict(vector<string>& words) {\n        root = new Node();\n        for(const auto& word : words)\n            add(word);\n\n        for(const auto& word : words){\n            if(dfs(0, 0, word.size(), word))\n                ans.push_back(word);\n        }\n        return ans;\n    }\n\nprivate:\n    Node* root;\n    vector<string> ans;\n    void add(const string& str) {\n        auto cur = root;\n        for(auto& ch : str) {\n            if(!cur->next[ch-\'a\']) cur->next[ch-\'a\'] = new Node();\n            cur = cur->next[ch-\'a\'];\n        }\n        cur->end = true;\n    }\n\n    bool dfs(int i, int cnt, int n, const string& s){\n        if(i == n) return cnt > 1;\n        auto cur = root;\n        while(i<n && cur->next[s[i]-\'a\'] != NULL) {\n            cur = cur->next[s[i] - \'a\'];\n            i++;\n            if(cur->end) {\n                if(dfs(i, cnt+1, n, s)) return true;\n            }\n        }\n        return false;\n    }\n};\n```
['Trie', 'C++']