Skip to content

Commit bdc380d

Browse files
committed
Time: 33 ms (99.51%), Space: 17 MB (80.39%) - LeetHub
1 parent 392c528 commit bdc380d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

1325-delete-leaves-with-a-given-value/1325-delete-leaves-with-a-given-value.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# time complexity: O(n)
2+
# space complexity: O(n)
13
from typing import Optional
24

35

@@ -10,7 +12,7 @@ def __init__(self, val=0, left=None, right=None):
1012

1113
class Solution:
1214
def removeLeafNodes(self, root: Optional[TreeNode], target: int) -> Optional[TreeNode]:
13-
if not root :
15+
if not root:
1416
return None
1517
root.left = self.removeLeafNodes(root.left, target)
1618
root.right = self.removeLeafNodes(root.right, target)

0 commit comments

Comments
 (0)