Evaluate Boolean Binary Tree
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given the root of a **full** binary tree (every node has zero or two children) that encodes a boolean expression.
- A leaf holds 0 (false) or 1 (true).
- An internal node holds 2, meaning **OR** of its two children, or 3, meaning **AND** of its two children.
Return the boolean result of evaluating the root.
Examples
Constraints
- 1 <= number of nodes <= 1000
- Leaves hold `0` or `1`; internal nodes hold `2` or `3`
- Every node has either 0 or 2 children
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.