摘要: 题目 和LeetCode530没什么区别 1 class Solution { 2 public: 3 vector<int>ans; 4 int minDiffInBST(TreeNode* root) { 5 int min = INT_MAX;dfs(root); 6 for(int i = 阅读全文
posted @ 2021-01-12 17:37 Uitachi 阅读(88) 评论(0) 推荐(0)
摘要: 题目 代码 简单递归 1 class Solution { 2 public: 3 TreeNode* searchBST(TreeNode* root, int val) { 4 if(!root) return NULL; 5 TreeNode* p; 6 if(root->val == val 阅读全文
posted @ 2021-01-12 17:18 Uitachi 阅读(72) 评论(0) 推荐(0)
摘要: 题目 纯暴力 1 class Solution { 2 public: 3 vector<int>ans; 4 int findSecondMinimumValue(TreeNode* root) { 5 dfs(root); 6 sort(ans.begin(),ans.end()); 7 int 阅读全文
posted @ 2021-01-12 16:49 Uitachi 阅读(68) 评论(0) 推荐(0)