publicintsumOfLeftLeaves(TreeNode root) {int sum =0;if (root ==null) {return sum; }// if we have left branchif (root.left!=null) {// if we found a left leaf, add it to sum;if (root.left.left==null&&root.left.right==null) { sum +=root.left.val; } else {// if we are not at the left leaf, we recur down to find the left leaf sum +=sumOfLeftLeaves(root.left); } }// after we done with left subtree, we add right subtree's left leaf nodes sum +=sumOfLeftLeaves(root.right);return sum;}