C++| EASY TO UNDERSTAND| Iterative| O(n) time-complexity
Please upvote to motivate me in my quest of documenting all leetcode solutions. HAPPY CODING:)\nclass Solution {\npublic:\n    int rangeSumBST(TreeNode* root, i
**Please upvote to motivate me in my quest of documenting all leetcode solutions. HAPPY CODING:)**\nclass Solution {\npublic:\n    int rangeSumBST(TreeNode* root, int low, int high) {\n        if(root==NULL)\n        return 0;\n        int sum=0;\n        if(root->val<=high&&root->val>=low)\n        {\n            sum+=root->val;\n        }\n        if(root->val>high)\n        {\n            sum+=rangeSumBST(root->left,low,high);\n        }\n        else if(root->val<low)\n        {\n            sum+=rangeSumBST(root->right,low,high);\n        }\n        else\n        {\n            sum+=rangeSumBST(root->right,low,high)+rangeSumBST(root->left,low,high);\n        }\n        return sum;\n    }\n};
['Binary Search Tree', 'C', 'Iterator']