179 - 131 分割回文串
Last updated
Was this helpful?
Last updated
Was this helpful?
给定一个字符串 s,将 s 分割成一些子串,使每个子串都是回文串。
返回 s 所有可能的分割方案。
示例:
输入: "aab" 输出: [ ["aa","b"], ["a","a","b"] ]
感觉可以回溯。算出结果,然后验证下是不是回文
方法还是需要两个变量:剩余选择+已走路径
Runtime: 80 ms, faster than 79.14% of Python3 online submissions for Palindrome Partitioning.
Memory Usage: 13 MB, less than 100.00% of Python3 online submissions for Palindrome Partitioning.