✅ C++ SOLUTION ☑️
PLEASE UPVOTE MY SOLUTION IF YOU LIKE IT\n# CONNECT WITH ME\n### https://www.linkedin.com/in/pratay-nandy-9ba57b229/\n#### https://www.instagram.com/pratay_nand
# **PLEASE UPVOTE MY SOLUTION IF YOU LIKE IT**\n# **CONNECT WITH ME**\n### **[https://www.linkedin.com/in/pratay-nandy-9ba57b229/]()**\n#### **[https://www.instagram.com/_pratay_nandy_/]()**\n\n# Approach\n\n### Explanation:\n\n1. **`solve` function:**\n   - Takes three parameters - `arr` (vector of strings), `str` (current string being constructed), and `index` (index of the next word to be added from the vector).\n   - Creates an unordered set `uset` containing unique characters from the current string `str`.\n   - Checks if the length of the string is equal to the size of the set. If not, it means there are duplicate characters, and the function returns 0.\n   - Initializes the answer `ans` with the length of the current string.\n   - Iterates over the remaining words in the vector `arr` starting from the given `index`.\n   - Recursively calls `solve` by appending each word to the current string, updating the index for the next iteration, and updating the maximum length obtained so far.\n\n2. **`maxLength` function:**\n   - Invokes the `solve` function to start the recursion with an empty string (`""`) and an initial index of 0.\n   - Returns the result obtained from the recursive exploration, which represents the maximum possible length of a string constructed from the given vector of words.\n\nThis code essentially explores all possible combinations of words from the vector `arr` to form a string while ensuring that each character in the string is unique. It uses backtracking and recursion to explore all possible combinations and returns the maximum length obtained. The `unordered_set` is used to check for duplicate characters in the current string.\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n<!-- - Time complexity:**0()** -->\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:**0(N)**\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n![upvote2.png](https://assets.leetcode.com/users/images/6198d926-527c-42f7-a663-aaf8d62ed44c_1704980133.0159707.png)\n\n# Code\n```\nclass Solution {\npublic:\nint solve(vector<string>& arr , string str , int index)\n{\n    unordered_set<char>uset(str.begin(),str.end());\n    if((int)str.length() != uset.size())\n    {\n        return 0 ;\n    }\n    int ans = str.length();\n    for(int i = index;i < arr.size();i++)\n    {\n        ans = max(ans,solve(arr,str + arr[i],i+1));   \n    }\n    return ans ; \n}\n\n    int maxLength(vector<string>& arr) {\n        return solve(arr, "", 0 );\n    }\n};\n```
['Array', 'Backtracking', 'C++']