摘要: ``` class Solution { public: vector dfs(TreeNode* root)//依次返回是否是二叉搜索树,最大值最小值 { vector res{1,root->val,root->val}; if(root->left) { auto l=dfs(root->le 阅读全文
posted @ 2023-05-24 14:39 穿过雾的阴霾 阅读(10) 评论(0) 推荐(0)
摘要: ``` class Solution { public: int countNodes(TreeNode* root) { if(!root) return 0; auto l=root->left,r=root->right; int x=1,y=1;//记录左右两边层数 while(l) l=l 阅读全文
posted @ 2023-05-24 14:15 穿过雾的阴霾 阅读(12) 评论(0) 推荐(0)