#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct TreeNode
{
TreeNode(): left(NULL), right(NULL){ }
TreeNode *left;
TreeNode *right;
int data;
};
int run(TreeNode *root) {
if (NULL == root)
return 0;
if (NULL == root->left && NULL == root->right)
return 1;
if (NULL == root->left || NULL == root->right){
return (run(root->left) >= run(root->right) ? run(root->left) : run(root->right)) + 1;
}
return (run(root->left) >= run(root->right) ? run(root->right) : run(root->left)) + 1;
}