Skip to content

Commit c2e3ec3

Browse files
committed
22-5-24
1 parent 3209545 commit c2e3ec3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

May-22-24.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution:
2+
def partition(self, s: str) -> List[List[str]]:
3+
def isPalindrome(s):
4+
return s==s[::-1]
5+
def bt(start=0,path=[]):
6+
if start==len(s):
7+
res.append(path)
8+
return
9+
for i in range(start+1,len(s)+1):
10+
if isPalindrome(s[start:i]):
11+
bt(i,path+[s[start:i]])
12+
res = []
13+
bt()
14+
return res

0 commit comments

Comments
 (0)