Skip to content

Commit 18a2c2a

Browse files
authored
Create Maximum Length of a Concatenated String with Unique Characters.py
1 parent b5713ab commit 18a2c2a

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+
#1239. Maximum Length of a Concatenated String with Unique Characters
2+
class Solution:
3+
def maxLength(self, arr: List[str]) -> int:
4+
uniques = ['']
5+
maxi = 0
6+
7+
for word in arr:
8+
for idx in range(len(uniques)):
9+
temp = word + uniques[idx]
10+
11+
if len(temp) == len(set(temp)):
12+
uniques.append(temp)
13+
maxi = max(maxi, len(temp))
14+
15+
return maxi

0 commit comments

Comments
 (0)