HTMLify

LeetCode - Root Equals Sum of Children - Go
Views: 12 | Author: abh
/**
 * 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
}

Comments