✅C++ Backtracking | Recursion Approach |very simple✔
Intuition\n Describe your first thoughts on how to solve this problem. \nSimple approach is backtracking ,to generate all the combinations like subsets of array
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nSimple approach is backtracking ,to generate all the combinations like subsets of array.The only thing here is to compare strings just check if they contain duplicates or their combination has duplicate if yes return ,if not the keep adding them in chain to make answer maximum as possible.\n# Approach\n<!-- Describe your approach to solving the problem. -->\nSo just do a simple recursion and egenearte all the combiantions possible and return if duplicate found (beacuse that will not lead to the answer,WE DONT WANT DUPLICATE CONCATENATION)\n# Complexity\n- Time complexity:$$O(n*n^2)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(n)$$ Don\'t take the recursive stack that is $$O(n^2)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n   int ans=0;\n   bool isUnique(string s){\n       set<char>st;\n       for(auto x:s)st.insert(x);\n       if(s.size()==st.size())return true;\n       return false;\n   }\n   void backtrack(vector<string>&arr,string temp,int start){\n        if(!isUnique(temp) )return ;\n        ans=max(ans,(int)temp.size());\n         for(int i=start;i<arr.size();i++)\n          backtrack(arr,temp+arr[i],i+1);\n           \n   }\n    int maxLength(vector<string>& arr) {\n        string s="";\n        backtrack(arr,s,0);\n        return ans;\n    }\n};\n```
['C++']