Algorithm · Meta · Hard
You are given a binary tree whose node values are all distinct, a node named target, and an integer K. Return the values of every node located exactly K edges away from target. Note: You may return the resulting values in any sequence. Example Input: Output: [7,9,14] Constraints The input tree contains at least one node. A node's distance from target is the count of edges on the path from target to that node. The tree contains fewer than 500 nodes. No two nodes in the tree…
Checking your access…