[C++/Python] in-order  BST traverse
\nclass Solution { // DFS: in-order traverse\npublic: // Time/Space Complexity: O(N); O(N)\n    int rangeSumBST(TreeNode* root, int low, int high) {\n        ve
```\nclass Solution { // DFS: in-order traverse\npublic: // Time/Space Complexity: O(N); O(N)\n    int rangeSumBST(TreeNode* root, int low, int high) {\n        vector<int> nums;\n        dfs(root, nums);\n        int ans = 0;\n        for(auto e: nums) \n            if(e >= low && e <=high) ans += e;\n        return ans;\n    }\n    \nprivate:\n    void dfs(TreeNode* root, vector<int>& nums){\n        if(!root) return;\n        dfs(root->left, nums);\n        nums.push_back(root->val);\n        dfs(root->right, nums);\n    }\n};\n```\n\nApproach 2(python)\n```\nclass Solution:\n    def rangeSumBST(self, root: Optional[TreeNode], low: int, high: int) -> int:\n        \n        def dfs(root):\n            if root:\n                dfs(root.left)\n                nums.append(root.val)\n                dfs(root.right)\n        \n        nums=[]\n        dfs(root)\n        running_sum = list(itertools.accumulate(nums))\n        left = max(bisect.bisect_left(nums, low)-1, 0)\n        right = min(bisect.bisect_left(nums, high), len(nums) - 1)                \n        return running_sum[right] - running_sum[left]\n```
['C++', 'Python3']