Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
For example, given s =
Return
"aab",Return
[ ["aa","b"], ["a","a","b"] ]
class Solution(object): def partition(self, s): """ :type s: str :rtype: List[List[str]] """ if len(s) == 0: return [[]] if len(s) == 1: return [[s]] res = [] for i in range(1, len(s)+1): part1 = s[:i] part2 = s[i:] #print part1, part2 if part1 == part1[::-1]: tmp_res = self.partition(part2) #print tmp_res for r in tmp_res: res.append([part1] + r) return res
How do you make money from a gaming career?
ReplyDeleteMake 1xbet korean money from a gaming career? Learn the basics of successful gambling with 바카라사이트 this a $5000 deposit match for online casino games, sportsbook หารายได้เสริม