Dsa
Binary Search Tree
Easy
Sum of Lone Sentinels
In a BST, a 'Lone Sentinel' is defined as a node that has exactly one child (either left or right, but not both). Given a sequence of unique integers to build a BST, calculate the sum of the values of all nodes that are Lone Sentinels.
Example:
Input: 10 5 15 3 12
Output: 20
Explanation: Node 5 has one child (3). Node 15 has one child (12). 10 has two, 3 and 12 have none. Sum = 5 + 15 = 20.
Key concepts
binary_search_treetree_traversalstructural_logic
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