【leetcode】222. 完全二叉树的节点个数

 

int countNodes(struct TreeNode* root){
    return (root)?countNodes(root->left)+countNodes(root->right)+1 :0;
}

 

posted @ 2020-12-28 17:06  温暖了寂寞  阅读(77)  评论(0编辑  收藏  举报