---
# System prepended metadata

title: 2331. Evaluate Boolean Binary Tree
tags: [Leetcode, Tree, Easy]

---

# 2331. Evaluate Boolean Binary Tree
###### tags: `Leetcode` `Easy` `Tree`
Link: https://leetcode.com/problems/evaluate-boolean-binary-tree/description/
## Code
```java=
class Solution {
    public boolean evaluateTree(TreeNode root) {
        if(root.val==0) return false;
        else if(root.val==1) return true;
        boolean b1 = evaluateTree(root.left);
        boolean b2 = evaluateTree(root.right);
        if(root.val==2) return b1||b2;
        else return b1&&b2;
    }
}
```