Skip to content

Commit 5e28daf

Browse files
committed
no message
1 parent 82cd50e commit 5e28daf

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

problems/delete-duplicate-folders-in-system.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def setKey(node):
2121
keyCount[node.key] += 1
2222

2323
def addPath(node, path):
24-
if node.children and keyCount[node.key]>1: return
24+
if node.children and keyCount[node.key]>1: return #leaf node does not apply to this rule
2525
ans.append(path+[node.val])
2626
for c in node.children:
2727
addPath(node.children[c], path+[node.val])
@@ -38,6 +38,11 @@ def addPath(node, path):
3838
if c not in node.children: node.children[c] = Node(c)
3939
node = node.children[c]
4040

41+
#set all nodes key recursively
4142
setKey(root)
42-
for c in root.children: addPath(root.children[c], [])
43+
44+
#build ans
45+
for c in root.children:
46+
addPath(root.children[c], [])
47+
4348
return ans

0 commit comments

Comments
 (0)