← Questions
Range sum of a BST
0
I was asked this
No reports yet. Sign in to say where you were asked it.
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 official answer yet. Write yours on the right and run it.
Nothing published yet.
Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding
