【leetcode】563. 二叉树的坡度
int recursion(struct TreeNode* root,int* sum){ if(!root) return 0; int left=recursion(root->left,sum); int right=recursion(root->right,sum); (*sum) += abs(left-right); return left+right+root->val; } int findTilt(struct TreeNode* root){ int sum=0; recursion(root,&sum); return sum; }