Question bank › Binary Search Tree
Dsa Binary Search Tree Easy

Network Path Latency

Routers in a network are organized as a BST based on their IDs. The 'Latency' between two routers is defined as the sum of all node IDs on the unique simple path between them. Given the insertion order for a BST and two router IDs, calculate the total path latency. You may assume both router IDs exist in the tree. Example: Input: 5 3 8 2 4 7 9; 2 4 Output: 9 Explanation: The path from 2 to 4 is 2 -> 3 -> 4. Sum: 2+3+4 = 9.

Key concepts

binary_search_treelowest_common_ancestorpath_sum

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.