Range sum of a BST
Given the root of a binary search tree and a range [low, high], return the sum of the values inside the range, skipping subtrees that cannot contain any.
Variants reported: return the average of those values instead; and if the tree is very large and the range changes often, how would you answer many queries faster?
No answer yet. Write the first one; the best answer gets endorsed.
