You are given the root of a binary tree that has exactly 3 nodes: the root, its left child and its right child. Return true if the root value equals the sum of the values of its two children, and false otherwise.
You are given the root of a binary tree that has exactly 3 nodes: the root, its left child and its right child. Return true if the root value equals the sum of the values of its two children, and false otherwise.
Example 1:
Input: {"root":[10,4,6]}
Output: true
Constraints:
The tree consists only of the root, its left child, and its right child.
−100≤Node.val≤100
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"root":[10,4,6]}
The root holds 10. Put it on one pan of the scale; its two children go on the other.