✅ One Line Solution
(Disclaimer: this is not an example to follow in a real project - it is written for fun and training mostly)\n\n# Code #1 - The Most Concise\nTime complexity: O
(Disclaimer: this is not an example to follow in a real project - it is written for fun and training mostly)\n\n# Code #1 - The Most Concise\nTime complexity: $$O(n)$$. Space complexity: $$O(n)$$.\n```\nclass Solution:\n    def rangeSumBST(self, r: Optional[TreeNode], l: int, h: int) -> int:\n        return (f:=lambda n:f(n.left)+n.val*(l<=n.val<=h)+f(n.right) if n else 0)(r)\n```\n\n# Code #2 - Simple And Straightforward\nTime complexity: $$O(n)$$. Space complexity: $$O(n)$$.\n```\nclass Solution:\n    def rangeSumBST(self, n: Optional[TreeNode], l: int, h: int) -> int:\n        return self.rangeSumBST(n.left,l,h)+n.val*(l<=n.val<=h)+self.rangeSumBST(n.right,l,h) if n else 0\n```\n\n# Code #3 - Return Zero Using bool()\nTime complexity: $$O(n)$$. Space complexity: $$O(n)$$.\n```\nclass Solution:\n    def rangeSumBST(self, n: Optional[TreeNode], l: int, h: int) -> int:\n        return bool(n) and self.rangeSumBST(n.left,l,h)+n.val*(l<=n.val<=h)+self.rangeSumBST(n.right,l,h)\n```\n\n# Code #4 - Return Zero At The End\nTime complexity: $$O(n)$$. Space complexity: $$O(n)$$.\n```\nclass Solution:\n    def rangeSumBST(self, n: Optional[TreeNode], l: int, h: int) -> int:\n        return n and self.rangeSumBST(n.left,l,h)+n.val*(l<=n.val<=h)+self.rangeSumBST(n.right,l,h) or 0\n```
['Tree', 'Depth-First Search', 'Binary Tree', 'Python', 'Python3']