...

/

Challenge: Find Nodes at k Distance from the Root

Challenge: Find Nodes at k Distance from the Root

Try to solve the Find Nodes at k Distance from the Root problem.

We'll cover the following...

Statement

Given the root node of a binary tree and an integer value k, find all the nodes at a distance of k from the root node.

Constraints:

Let n be the number of nodes in a binary tree.

  • 11 \leq n 500\leq 500
  • 00 \leq Node.data 103\leq 10^3
  • All Node.data are unique

Examples

Access this course and 1400+ top-rated courses and projects.