1593. 拆分字符串使唯一子字符串的数目最大
传送门
传送门
题意
结题思路
class Solution(object):
def maxUniqueSplit(self
, s
):
len1
= len(s
)
if len1
== 1:
return 1
def dfs(cur
, ss
):
if(cur
== len1
-1):
return len(set(ss
.split
()))
cur
+= 1
return max(dfs
(cur
, ss
+ s
[cur
]), dfs
(cur
, ss
+ ' ' + s
[cur
]))
return dfs
(0, s
[0])
本文如有纰漏,可评论向我提意见哦
简单问题关注我后可以帮忙解答,
祝关注+点赞的小可爱刷题顺利,获得心仪的offer!!
转载请注明原文地址:https://blackberry.8miu.com/read-36000.html