Evaluate the expression represented by a full binary tree and return its Boolean result. Every node has either no children or exactly two children. A leaf value of 0 means false, and 1 means true. An internal value of 2 applies OR to its children; an internal value of 3 applies AND.
Examples use level-order arrays. After the root, each present node contributes left and right child entries in queue order. null marks a missing child, and trailing missing entries may be omitted.
Example 1:
Input: root = [3,1,2,null,null,0,1]
Output: trueExplanation: The right subtree computes false OR true, which is true. The root then computes true AND true, giving true.
Example 2:
Input: root = [2,0,3,null,null,1,0]
Output: falseExplanation: The right subtree computes true AND false, which is false. The root computes false OR false, giving false.
Example 3:
Input: root = [1]
Output: trueExplanation: The root is a leaf with value 1, so the expression is true.
Constraints:
- The tree contains between 1 and 1000 nodes.
- Every node has either zero or two children.
- Leaves contain 0 or 1. Internal nodes contain 2 or 3.