摘要: 235. 二叉搜索树的最近公共祖先 class Solution { public: TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {if(root==NULL)return NULL; if((ro 阅读全文
posted @ 2023-01-19 17:46 芝士可乐 阅读(24) 评论(0) 推荐(0)
摘要: 530. 二叉搜索树的最小绝对差 遇到在二叉搜索树上求什么最值,求差值之类的,都要思考一下二叉搜索树可是有序的,要利用好这一特点。 class Solution { public: vector<int>vec; void getvec(TreeNode* root){ if(root==NULL) 阅读全文
posted @ 2023-01-19 00:19 芝士可乐 阅读(21) 评论(0) 推荐(0)