```
class Solution {
public:
int sumOfLeftLeaves(TreeNode* root) {
int sum = 0;
sumOfLeftLeaves_helper(root, sum, false);
return sum;
}
void sumOfLeftLeaves_helper(TreeNode* root, int& sum, bool left){
if (!root) return;
if (root->left || root->right){
sumOfLeftLeaves_helper(root->left, sum, true);
sumOfLeftLeaves_helper(root->right, sum, false);
} else if (left){
sum += root->val;
}
}
};
```