MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / dfs

Method dfs

python/0131-palindrome-partitioning.py:5–13  ·  view source on GitHub ↗
(i)

Source from the content-addressed store, hash-verified

3 res, part = [], []
4
5 def dfs(i):
6 if i >= len(s):
7 res.append(part.copy())
8 return
9 for j in range(i, len(s)):
10 if self.isPali(s, i, j):
11 part.append(s[i : j + 1])
12 dfs(j + 1)
13 part.pop()
14
15 dfs(0)
16 return res

Callers

nothing calls this directly

Calls 3

isPaliMethod · 0.95
dfsFunction · 0.50
popMethod · 0.45

Tested by

no test coverage detected