Question bank › Binary Search Tree
Dsa Binary Search Tree Medium

Mirror Intersection Sum

You are given two sequences A and B. 1. Build a standard BST from sequence A (values smaller than parent go left, else right). 2. Build a 'Mirrored' BST from sequence B: values GREATER than or equal to parent go LEFT, values smaller than parent go RIGHT. Find the sum of all values that exist in both trees at the exact same depth. Example: Input line 1: 10 5 15 Input line 2: 10 15 5 Tree A: root 10 (d0), 5 (d1-left), 15 (d1-right). Tree B: root 10 (d0), 15 (d1-left), 5 (d1-right). Common (depth, value) pairs: (0, 10), (1, 5), (1, 15). Output: 30

Key concepts

binary_search_treetree_constructiondepth_analysis

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.