标签:style rip int 二叉树 ntc ble val color find
测试代码:
1 class Solution { 2 public: 3 int countChild(TreeNode* node) { 4 if (node == nullptr) return 0; 5 return node->val + countChild(node->left) + countChild(node->right); 6 } 7 8 int findTilt(TreeNode* root) { 9 if (root == nullptr) return 0; 10 return abs(countChild(root->left) - countChild(root->right)) + findTilt(root->left) + findTilt(root->right); 11 } 12 };
标签:style rip int 二叉树 ntc ble val color find
原文地址:https://www.cnblogs.com/sunbines/p/9670077.html