2236. Root Equals Sum of Children
🟩 Easy
Solution
My Solution
/**
* Definition for a binary tree node.
* type TreeNode struct {
* Val int
* Left *TreeNode
* Right *TreeNode
* }
*/
func checkTree(root *TreeNode) bool {
return root.Val == (root.Left.Val + root.Right.Val)
}

Leetcode: link
Last updated
Was this helpful?