Algorithm · Meta · Easy
Given a binary search tree's root along with integers low and high, calculate the total of every node value that falls within the inclusive interval [low, high]. Input: root: The binary search tree's root node low: An integer value high: An integer value Output: The combined total of node values that lie in [low, high] Example: Constraints: The tree contains between 1 and 2 * 10^4 nodes, inclusive. 1 <= Node.val <= 10^5 1 <= low <= high <= 10^5 Every Node.val is distinct.…
Checking your access…