/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
bool in_order(TreeNode *root,int num)
{
if(root==NULL)return true;
if(root->val!=num)return false;
int tmp = root->val;
return in_order(root->left,tmp)&&in_order(root->right,tmp);
}
bool isUnivalTree(TreeNode* root) {
int num= root->val;
return in_order(root->left,num)&&in_order(root->right,num);
}
};