class Solution {
public:
bool evaluateTree(TreeNode* root) {
return dfs(root);
}
bool dfs(TreeNode * root){
switch(root->val){
case(0) : return false;
case(1) : return true;
case(2) : return dfs(root->left) || dfs(root->right);
case(3) : return dfs(root->left) && dfs(root->right);
}
return false;
}
};
标签:case,2331,right,return,dfs,二叉树,root,LeetCode
From: https://www.cnblogs.com/zjacky/p/17095296.html