Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution(object):
- def partition(self, s):
- """
- :type s: str
- :rtype: List[List[str]]
- """
- ret = []
- for i in range(1, len(s)+1):
- t = s[:i]
- if t == t[::-1]:
- soln = [[t] + w for w in self.partition(s[i:])]
- ret.extend(soln)
- if not ret:
- return [[]]
- return ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement