Root Equals Sum of Children (Leetcode 2236)

Problem Link: https://leetcode.com/problems/root-equals-sum-of-children/

class Solution:
    def checkTree(self, root: Optional[TreeNode]) -> bool:
        if(root.left.val+root.right.val==root.val):
            return True
        return False

Last updated