标签:code tco col lag nod elf get += flag
1 class Solution: 2 ans = 0 3 def sumOfLeftLeaves(self, root: TreeNode) -> int: 4 def dfs(root,flag): 5 if not root:return 6 if not root.left and not root.right and flag: 7 self.ans += root.val 8 dfs(root.left, True) 9 dfs(root.right, False) 10 dfs(root,False) 11 return self.ans 12 13
标签:code tco col lag nod elf get += flag
原文地址:https://www.cnblogs.com/lj95/p/14321232.html