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