Search
⌘K

Leetcode 863. All Nodes Distance K in Binary Tree

Given a binary tree and a target node value, return all node values at distance K from the target. The challenge is to traverse both downwards and upwards (treat the tree as an undirected graph or add parent pointers) and perform a breadth-/depth-first search to collect nodes exactly K edges away.

Asked at:

Microsoft

Microsoft

Meta

Amazon

Amazon


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Mid February, 2026

Microsoft

Microsoft

Senior

Mid November, 2025

Microsoft

Microsoft

Mid-level

Early October, 2025

Amazon

Amazon

Mid-level

Comments

Your account is free and you can post anonymously if you choose.