Good morning! Here's your coding interview problem for today.
This problem was asked by Google.
Given a binary search tree and a range [a, b] (inclusive), return the sum of the elements of the binary search tree within the range.
For example, given the following tree:
5
/
3 8
/ \ /
2 4 6 10
and the range [4, 9], return 23 (5 + 4 + 6 + 8).