[C++] Simple C++ Code || No Trie || 73% time || 78% space
If you like the implementation then Please help me by increasing my reputation. By clicking the up arrow on the left of my image.\n\nclass Solution {\n    unord
# **If you like the implementation then Please help me by increasing my reputation. By clicking the up arrow on the left of my image.**\n```\nclass Solution {\n    unordered_map<string, int> um;\n    vector<string> ans;\n    bool dfs(string &str, int i)\n    {\n        if(i == str.size())\n        {\n            return true;\n        }\n        string tmp = "";\n        for(int j = i; j < str.size(); j++)\n        {\n            tmp += str[j];\n            if(j == str.size()-1 && i == 0)\n                return false;\n            else if(um.count(tmp))\n            {\n                if(dfs(str, j+1)) return true;\n            }\n        }\n        return false;\n    }\npublic:\n    vector<string> findAllConcatenatedWordsInADict(vector<string>& words) {\n        for(string &str : words)\n            um[str]++;\n        for(string &str : words)\n        {\n            if(dfs(str, 0))\n                ans.push_back(str);\n        }\n        return ans;\n    }\n};\n```
['Backtracking', 'Recursion', 'C']