โ† Microsoft questions

Minimum Distance Between Two Nodes

Filed under Microsoft

Given the root of a binary tree and two node values p and q, calculate the minimum distance (number of edges on the shortest path) between node p and node q in the binary tree.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Microsoft questions

Collected from public candidate posts and coding forums. Updated Nov 2026.