1
var sumOfLeftLeaves = function (root) {
2
let total = 0;
3

4
const go = (node, isLeft) => {
5
if (isLeft && !node.left && !node.right) {
6
total += node.val;
7
return;
8
}
9
if (node.left) go(node.left, true);
10
if (node.right) go(node.right, false);
11
};
12

13
go(root, false);
14

15
return total;
16
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0