## 一、530.二叉搜索树的最小绝对差

``````/*** Definition for a binary tree node.* struct TreeNode {*     int val;*     TreeNode *left;*     TreeNode *right;*     TreeNode() : val(0), left(nullptr), right(nullptr) {}*     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}*     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}* };*/
class Solution {
private:int result = INT_MAX;TreeNode* pre = NULL;void traversal(TreeNode* cur){if(cur == NULL) return;traversal(cur->left);if(pre != NULL)result = min(result, cur->val - pre->val);pre = cur;traversal(cur->right);}public:int getMinimumDifference(TreeNode* root) {traversal(root);return result;}
};
``````

https://programmercarl.com/0530.%E4%BA%8C%E5%8F%89%E6%90%9C%E7%B4%A2%E6%A0%91%E7%9A%84%E6%9C%80%E5%B0%8F%E7%BB%9D%E5%AF%B9%E5%B7%AE.html

## 二、501.二叉搜索树中的众数

``````/*** Definition for a binary tree node.* struct TreeNode {*     int val;*     TreeNode *left;*     TreeNode *right;*     TreeNode() : val(0), left(nullptr), right(nullptr) {}*     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}*     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}* };*/
class Solution {
private:int maxCount = 0;int count = 0;TreeNode* pre = NULL;vector<int> result;void searchBST(TreeNode* cur){if(cur == NULL) return;searchBST(cur->left);if(pre == NULL)count = 1;else if(pre->val == cur->val)count ++;elsecount = 1;pre = cur;if(count == maxCount)result.push_back(cur->val);if(count > maxCount){maxCount = count;result.clear();result.push_back(cur->val);}searchBST(cur->right);return;}public:vector<int> findMode(TreeNode* root) {count = 0;maxCount = 0;pre = NULL;result.clear();searchBST(root);return result;}
};
``````

## 三、236. 二叉树的最近公共祖先

``````/*** Definition for a binary tree node.* struct TreeNode {*     int val;*     TreeNode *left;*     TreeNode *right;*     TreeNode(int x) : val(x), left(NULL), right(NULL) {}* };*/
class Solution {
public:TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {if(root == q || root == p || root == NULL) return root;TreeNode* left = lowestCommonAncestor(root->left, p, q);TreeNode* right = lowestCommonAncestor(root->right, p, q);if(left != NULL && right != NULL) return root;if(left == NULL) return right;return left;}
};
``````

https://programmercarl.com/0236.%E4%BA%8C%E5%8F%89%E6%A0%91%E7%9A%84%E6%9C%80%E8%BF%91%E5%85%AC%E5%85%B1%E7%A5%96%E5%85%88.html

### R包Colorfindr识别图片颜色｜用刀剑神域方式打开SCI科研配色

1.前言 最近忙里偷闲&#xff0c;捣鼓一下配色&#xff0c;把童年回忆里的动漫都搬进来&#xff0c;给科研信仰充值吧&#xff5e; 提取颜色之前写过一个Py的&#xff0c;那个很准确不过调参会有点麻烦。这里分享一个比较懒人点的R包吧&#xff0c;虽然会有一定误差&#xff…

### 灵动微单片机洗衣机方案——【软硬件开发支持】

RAMSUN英尚以洗衣机洗涤主驱电机为例&#xff0c;主驱电机和多电机控制首选MM32SPIN0280.灵动微电子能够提供完整的软硬件开发支持&#xff0c;目前方案已经在主流家电厂出货。 洗衣机方案 皮带洗衣机 DD直驱洗衣机 波轮洗衣机 Mini壁挂和桌面洗衣机 洗涤烘干双变频方案 热泵烘…

### clickhouse——clickhouse单节点部署及基础命令介绍

clickhouse支持运行在主流的64位CPU架构的linux操作系统之上&#xff0c;可以通过源码编译&#xff0c;预编译压缩包&#xff0c;docker镜像和rpm等多种方式进行安装。 一、单节点部署 1、安装curl工具 yum install -y curl 2、添加clickhouse的yum镜像 curl -s https://pack…