As reported: Nutanix MTS3 hiring drive (2025), round 1: All Nodes Distance K in Binary Tree; follow-up: solve it without extra memory (the intended answer uses only the DFS recursion stack).
Given the root of a binary tree, a target node and an integer k, return the values of all nodes at distance k from target, in any order. This is LeetCode 863 — All Nodes Distance K in Binary Tree.
Example 1
root = [3,5,1,6,2,0,8,null,null,7,4], target = 5, k = 2 -> [7,4,1]
Example 2
root = [1], target = 1, k = 3 -> []
Constraints: 1 ≤ nodes ≤ 500; values are unique, 0 ≤ val ≤ 500; 0 ≤ k ≤ 1000.
Follow-up: no parent map or extra graph — only recursion.
Code runner format: one JSON value per line: the tree (LeetCode's level order), the target's value, k. Implement distanceK(root, target, k); values may be in any order (the harness sorts them).