0938. Range Sum of BST

https://leetcode.com/problems/range-sum-of-bst

Description

Given the root node of a binary search tree and two integers low and high, return the sum of values of all nodes with a value in the inclusive range [low, high].

Example 1:

Example 2:

Constraints:

  • The number of nodes in the tree is in the range [1, 2 * 104].

  • 1 <= Node.val <= 105

  • 1 <= low <= high <= 105

  • All Node.val are unique.

ac

Last updated

Was this helpful?