1
class Solution {
2
public int sumOfLeftLeaves(TreeNode root) {
3

4
if (root == null) return 0;
5

6
if (root.left != null && root.left.left == null && root.left.right == null) {
7
return root.left.val + sumOfLeftLeaves(root.left) + sumOfLeftLeaves(root.right);
8
} else {
9
return sumOfLeftLeaves(root.left) + sumOfLeftLeaves(root.right);
10
}
11
}
12
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0