📌📌 C++ || DFS || Hashset || Faster || Easy To Understand
Using DFS && Hashset\n\n Time Complexity :- O(N * L * L)\n\n Space Complexity :- O(N * L), Where L is the size of the string\n\n\nclass Solution {\npublic:\n   
* ***Using DFS && Hashset***\n\n* ***Time Complexity :- O(N * L * L)***\n\n* ***Space Complexity :- O(N * L), Where L is the size of the string***\n\n```\nclass Solution {\npublic:\n    \n    // set will store all the words of words\n    \n    unordered_set<string> s;\n    \n    bool helper(string& str, int i, int n)\n    {\n        // base case\n        \n        if(i == n)\n            return true;\n        \n        // partition str at j and call for next\n        \n        for(int j = i; j < n; j++)\n        {\n            if(str.substr(i, j - i + 1) != str && s.count(str.substr(i, j - i + 1)))\n            {\n                if(helper(str, j + 1, n))\n                    return true;\n            }\n        }\n        \n        return false;\n    }\n    \n    vector<string> findAllConcatenatedWordsInADict(vector<string>& words) {\n        \n        // insert all the word of words into s\n        \n        for(auto word : words)\n        {\n            s.insert(word);\n        }\n        \n        vector<string> res;\n        \n        // iterate over words and check for each word is it concatenated or not\n        \n        for(auto word : words)\n        { \n            if(helper(word, 0, word.size()))\n                res.push_back(word);\n        }\n        \n        return res;\n    }\n};\n```
['Depth-First Search', 'C', 'C++']