Dsa
Binary Search Tree
Easy
The Even Successor
In a network of servers identified by unique integer IDs organized in a BST, when a server X fails, the system must failover to the 'Smallest Even Successor'. This is the smallest server ID that is strictly greater than X and is an even number. If no such server exists in the tree, output 'None'.
Example:
Input:
15 10 20 8 12 18 25
10
Output: 12
Explanation: Nodes > 10 are {12, 15, 18, 20, 25}. Even ones are {12, 18, 20}. Smallest is 12.
Key concepts
binary_search_treesuccessorfiltering
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