C# solutions


  • 0
    T
       public int SumOfLeftLeaves(TreeNode root) {
            if(root==null)
            {
                return 0;
            }
            if(root.left!=null && root.left.left==null && root.left.right==null)
           {
               return root.left.val+SumOfLeftLeaves(root.right);
           }
           return SumOfLeftLeaves(root.left)+SumOfLeftLeaves(root.right);
        }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.