filmov
tv
Leetcode 938 | Range Sum of Binary Search Tree(BST) | Range Sum of BST (Detailed solution)

Показать описание
Range Sum of Binary Search Tree(BST) is a leetcode problem asked in tech company coding interview round. One of the easy problem based on tree, where we need to find sum of node, if value falls in a particular range.
This video explains the solution by the tech granth.
can be asked in the coding interview of tech companies like amazon coding interview, google coding round, facebook and microsoft coding interview
#thetechrganth #leetcode
problem statement:
Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive).
The binary search tree is guaranteed to have unique values.
Example 1:
Input: root = [10,5,15,3,7,null,18], L = 7, R = 15
Output: 32
Example 2:
Input: root = [10,5,15,3,7,13,18,1,null,6], L = 6, R = 10
Output: 23
This video explains the solution by the tech granth.
can be asked in the coding interview of tech companies like amazon coding interview, google coding round, facebook and microsoft coding interview
#thetechrganth #leetcode
problem statement:
Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive).
The binary search tree is guaranteed to have unique values.
Example 1:
Input: root = [10,5,15,3,7,null,18], L = 7, R = 15
Output: 32
Example 2:
Input: root = [10,5,15,3,7,13,18,1,null,6], L = 6, R = 10
Output: 23