
Input: root =[10,4,6]Output: trueExplanation: The values of the root, its left child, and its right child are 10,4, and 6, respectively.10is equal to 4+6, so we returntrue.

Input: root =[5,3,1]Output: falseExplanation: The values of the root, its left child, and its right child are 5,3, and 1, respectively.5is not equal to 3+1, so we returnfalse.
The problem is very simple: since the tree only has three nodes (root, left, right), we just need to check if the root’s value equals the sum of its two children. No recursion or traversal is needed.
Access the root, its left, and right children. Return true if root.val == root.left.val + root.right.val, otherwise return false. This is a direct comparison.