Question bank › Binary Search Tree
Dsa Binary Search Tree Medium

Count Nodes in Range in BST

Given a binary search tree, write a function to count the number of nodes that fall within a given range [low, high]. The input consists of an integer n denoting the number of nodes, followed by n integers that represent the node values. Finally, two integers representing the range low and high. Output the count of nodes in that range. Example Input: 4 10 20 5 15 10 20 Example Output: 3

Key concepts

binary_search_treerange_querycount

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 Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.