Find All Tree Nodes at Distance K

Read the full interview experience this question came from →

Quick Overview

Return every binary-tree node exactly k undirected edges from a target node, sorted by value for deterministic output. Use node identity despite duplicate values and handle missing targets, empty trees, zero distance, and distances beyond the tree.

Find All Tree Nodes at Distance K

Company: Apple

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

Overview: Return every binary-tree node exactly k undirected edges from a target node, sorted by value for deterministic output. Use node identity despite duplicate values and handle missing targets, empty trees, zero distance, and distances beyond the tree.

Read the full Apple Software Engineer interview experience this question came from

|Home/Coding & Algorithms/Apple
Apple logo
Apple
Jun 3, 2026
mediumSoftware EngineerOnsiteCoding & Algorithms
2
0
Loading...

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...