/**

  • struct TreeNode {
  • int val;
  • struct TreeNode *left;
  • struct TreeNode *right;
  • };
  • /

class Solution {
public:
/*
*
* @param root TreeNode类
* @return int整型
*/
int run(TreeNode
root) {
// write code here
if(root == nullptr) return 0;

    if(root->left==nullptr && root->right!=nullptr) return 1 + run(root->right);
    if(root->left!=nullptr && root->right==nullptr) return 1 + run(root->left);

    return 1 + min(run(root->left),run(root->right));
}

};