# 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; } } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up