Class Solution
java.lang.Object
g0901_1000.s0938_range_sum_of_bst.Solution
938 - Range Sum of BST.<p>Easy</p>
<p>Given the <code>root</code> node of a binary search tree and two integers <code>low</code> and <code>high</code>, return <em>the sum of values of all nodes with a value in the <strong>inclusive</strong> range</em> <code>[low, high]</code>.</p>
<p><strong>Example 1:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2020/11/05/bst1.jpg" alt="" /></p>
<p><strong>Input:</strong> root = [10,5,15,3,7,null,18], low = 7, high = 15</p>
<p><strong>Output:</strong> 32</p>
<p><strong>Explanation:</strong> Nodes 7, 10, and 15 are in the range [7, 15]. 7 + 10 + 15 = 32.</p>
<p><strong>Example 2:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2020/11/05/bst2.jpg" alt="" /></p>
<p><strong>Input:</strong> root = [10,5,15,3,7,13,18,1,null,6], low = 6, high = 10</p>
<p><strong>Output:</strong> 23</p>
<p><strong>Explanation:</strong> Nodes 6, 7, and 10 are in the range [6, 10]. 6 + 7 + 10 = 23.</p>
<p><strong>Constraints:</strong></p>
<ul>
<li>The number of nodes in the tree is in the range <code>[1, 2 * 10<sup>4</sup>]</code>.</li>
<li><code>1 <= Node.val <= 10<sup>5</sup></code></li>
<li><code>1 <= low <= high <= 10<sup>5</sup></code></li>
<li>All <code>Node.val</code> are <strong>unique</strong>.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
rangeSumBST
-