Your question is Range Sum in Binary Tree. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
In a Meta interview setting, you are given the root of a binary tree and two integers low and high. Return the sum of all node values v such that low <= v <= high.
Assume the tree is a binary search tree (BST), which allows you to skip subtrees that cannot contain valid values.
root as a binary tree node (or null), and integers low, high[low, high]def range_sum_bst(root, low, high):