```
class Solution {
public:
bool b = false;
bool checkEqualTree(TreeNode* root) {
int sum = chsum(root);
if((sum%2 != 0) || root == NULL || (root->left == NULL && root->right == NULL))
return false;
chsum(root,sum/2);
return b;
}
int chsum(TreeNode* root,double chk=0.5){
if(root == NULL || b) return 0;
int sum = root->val+chsum(root->left, chk) + chsum(root->right, chk);
if(sum == chk) b = true;
return sum;
}
};
```