class Solution {
public:
int ans=INT_MAX;
int last;
bool is_first=true;
int getMinimumDifference(TreeNode* root) {
dfs(root);
return ans;
}
void dfs(TreeNode* root)
{
// 中序遍历
if(!root)return;
dfs(root->left);
if(is_first)is_first=false;
else ans=min(ans, root->val-last);
last=root->val;
dfs(root->right);
}
};