Community

Start a Thread


Notifications
Subscribe You’re not receiving notifications from this thread.

Right Node View of Binary Tree (Main Thread)

Here is the interview question prompt, presented for reference.

A binary search tree is a data structure that has the following properties, - Each node in the tree has only two children. - The left subtree consists of nodes with values less than the root node. - The right subtree consists of nodes with values greater than the root node.

Consider a binary tree with the root node given as root. Your task is to return the values of the nodes that are on the right side of the binary tree, ordered from top to bottom.

![image](https://storage.googleapis.com/algodailyrandomassets/curriculum/binary-search-trees/right-node-view-bst/problem.png)

For example, consider the tree in the image above. On the right side of the tree, we see the values 9, 11, and 16. These are returned as an array [9, 11, 16].

Constraints

  • The number of nodes in the tree is in the range [0, 100].
  • 100 <= Node.val <= 100

You can see the full challenge with visuals at this link.

Challenges • Asked over 1 year ago by Jake from AlgoDaily

Jake from AlgoDaily Commented on Aug 28, 2022:

This is the main discussion thread generated for Right Node View of Binary Tree (Main Thread).