Question bank › Binary Search Tree
Dsa Binary Search Tree Hard

Binary Search Tree Range Sum

Given a binary search tree (BST) and two integer values, low and high, return the sum of the values of all nodes with a value in the inclusive range [low, high]. Input Format: The first line contains an integer n, the number of nodes in the BST. The second line contains n space-separated integers representing the values of the nodes. The third line contains two integers low and high. Output Format: Print a single integer representing the sum of values within the range. Example: Input: 5 10 5 15 3 7 7 15 Output: 32

Key concepts

binary_treerange_sumrecursion

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.