Skip to content

Commit 43858fd

Browse files
committed
Time: 166 ms (35.99%), Space: 62.5 MB (35.27%) - LeetHub
1 parent a05cf73 commit 43858fd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
public:
3+
int maxLength(vector<string>& arr, string str = "", int index = 0) {
4+
5+
unordered_set<char>s(str.begin(), str.end());
6+
if (s.size() != ((int)str.length()))
7+
return 0;
8+
9+
int ret = str.length();
10+
for (int i = index; i < arr.size(); i++)
11+
ret = max(ret, maxLength(arr, str+arr[i], i+1));
12+
13+
return ret;
14+
}
15+
};

0 commit comments

Comments
 (0)