题解:
DFS 深搜
class Solution {
public boolean evaluateTree(TreeNode root) {
switch (root.val) {
case 0 : return false;
case 1 : return true;
case 2 : return evaluateTree(root.left) || evaluateTree(root.right);
case 3 : return evaluateTree(root.left) && evaluateTree(root.right);
}
return true;
}
}
标签:case,2331,return,evaluateTree,二叉树,root,布尔
From: https://www.cnblogs.com/eiffelzero/p/17096542.html