标签:style range nod ret null div color += class
题目
1 class Solution { 2 public: 3 int sum = 0; 4 int rangeSumBST(TreeNode* root, int low, int high) { 5 dfs(root,low,high); 6 return sum; 7 } 8 void dfs(TreeNode* root,int low,int high){ 9 if(root!=NULL){ 10 dfs(root->left,low,high); 11 if(root->val >= low && root->val <= high) 12 sum += root->val; 13 dfs(root->right,low,high); 14 } 15 } 16 };
标签:style range nod ret null div color += class
原文地址:https://www.cnblogs.com/fresh-coder/p/14272679.html