

def backtrack(self, s, cur_lvl, ret):
    '\n        Expand the search tree horizontally.\n        i be the scanning index\n        If s[:i] is palindrome, then palindrome partition the s[i:]\n\n        :param s: the current temp string\n        :param cur_lvl: the current temp result at current level\n        :param ret: result\n        :return:\n        '
    if (not s):
        ret.append(list(cur_lvl))
    for i in xrange(1, (len(s) + 1)):
        if self.predicate(s[:i]):
            cur_lvl.append(s[:i])
            self.backtrack(s[i:], cur_lvl, ret)
            cur_lvl.pop()

dataset/ETHPy150Open algorhythms/LintCode/Palindrome Partitioning.py Solution.backtrack/original