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
PreviousEvaluate Boolean Binary Tree (Leetcode 2331)NextSearch in a Binary Search Tree(BST) (Leetcode 700)
Last updated