✅C++💯💯image detailed explanation ✅✅ recursion
\n\n\n\nNOTE:-here emoji says that ""ca","t" and "dogcats" all are present in set and returning true. if some part like tdogcats did not returened true as it wa
![Screenshot (735).png](https://assets.leetcode.com/users/images/9f393807-9971-447a-96a6-9f94001fb861_1674798993.8750749.png)\n![Screenshot (734).png](https://assets.leetcode.com/users/images/2b2826c0-3bc9-4d60-b3a5-322fd8ee4774_1674799019.1884854.png)\n![Screenshot (736).png](https://assets.leetcode.com/users/images/c31195ad-b430-43ca-bd45-157992360e6a_1674799031.5851164.png)\n\n**NOTE:-**here emoji says that "**"ca"**,**"t"** and **"dogcats"** all are present in set and returning true. if some part like **tdogcats** did not returened true as it was not present in our map .then we breaked it as the same way we did earlier so ,simply pass it to recursive function.. when it returns true from both side only then add that word to our answer.. \n\n\n**i draw all this things for you..so that you feel the problem.if you gain something then please motivate me by upvoting my solution.**\n\nLets Connect On Linkedin https://www.linkedin.com/in/sonal-prasad-sahu-78973a229/\n\n\n# Code\n```\nclass Solution {\npublic: bool concat_possible(string &word,vector<string>& words, unordered_map<string,int>&mp){\n          int size=word.size();\n          for(int i=1;i<size;++i){ \n              string prefix=word.substr(0,i);// left subpart\n              string suffix=word.substr(i);  // right subpart\n              if(mp[prefix] && (mp[suffix] || concat_possible(suffix,words,mp))){   /*checking if left and right subpart is present in map or not .\nif one subpart is present(lets say prefix) and other is not(lets say suffix) then recursively check the suffix subpart .if both subparts is present then return true*/\n                  return true;\n              }\n          }\n          return false;\n}\n    vector<string> findAllConcatenatedWordsInADict(vector<string>& words) {\n        vector<string>ans;\n        unordered_map<string,int>mp; \n        for(auto string:words){   //storing each words into unordered_map\n            mp[string]++;\n        }\n\n\n        for(auto &word:words){  //check for each word .if its return true then add it into our solution\n            if(concat_possible(word,words,mp)){\n                ans.push_back(word);\n            }\n        }\n        return ans;\n    }\n};\n```\n![begging.jpg](https://assets.leetcode.com/users/images/437a3a83-5b50-406d-a2e0-4f5d625402ab_1674799238.571603.jpeg)\n
['Recursion', 'C++']