Dsa
Binary Search Tree
Easy
The Weight Equilibrium Node
Each node in a BST represents a cargo container with a weight equal to its ID. Find the ID of the node where the sum of weights in its left subtree is exactly equal to the sum of weights in its right subtree. If multiple such nodes exist, return the smallest ID. If none, return 'None'.
Example:
Input:
10 5 15
Output: 5
Explanation: Node 5 has left_sum 0 and right_sum 0. Node 15 also has 0 == 0. Smallest is 5. Node 10 has 5 != 15.
Key concepts
binary_search_treesubtree sumpost-order
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