Search⌘ K

DIY: Range Sum of BST

Understand how to compute the sum of all node values in a binary search tree that fall within a specified range, including the boundary values. Practice implementing this function prepares you for real coding interview challenges, especially those similar to Amazon's problem-solving tasks.

Problem statement

For this challenge, you are given the root node of a binary search tree and two values: low and high. Your task is to return the sum of the values of all nodes in BST that are value between ...