```
public class Solution {
int sum = 0;
public int sumOfLeftLeaves(TreeNode root) {
sum(root, false);
return sum;
}
private void sum(TreeNode node, boolean isLeft) {
if (node == null) return;
sum(node.left, true);
sum(node.right, false);
if (isLeft && (node.left == null && node.right == null)) sum+=node.val;
}
}
```