✅C++ | ✅Inorder Traversal | ✅Intuitive Approach
Intuition\nInorder traversal of BST returns nodes in sorted order.\n\n# Approach\nWhile sorting nodes by using inorder traversal, we sum up all the nodes values
# Intuition\nInorder traversal of BST returns nodes in sorted order.\n\n# Approach\nWhile sorting nodes by using inorder traversal, we sum up all the nodes values lies between the range.\n\n# Complexity\n- Time complexity: O(N) \n\n- Space complexity: O(N)\n\n# Code\n```\nclass Solution \n{\npublic:\n    void inorder(TreeNode* node, int &low, int &high, int &sum)\n    {\n        if(!node) return;\n        inorder(node->left, low, high, sum);\n        if(node->val >= low && node->val <= high) sum += node->val;\n        inorder(node->right, low, high, sum);\n    }\n    int rangeSumBST(TreeNode* root, int low, int high) \n    {\n        int sum=0;\n        inorder(root, low, high, sum);\n        return sum;  \n    }\n};\n```
['Depth-First Search', 'Binary Search Tree', 'Recursion', 'C++']