Binary Tree Right side View LeetCode (Print right view of a binary tree)

Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.
For example:
Given the following binary tree,
   1            <---
 /   \
2     3         <---
 \     \
  5     4       <---
You should return [1, 3, 4].
This problem is popular in LeetCode and GeeksForGeeksA collection of hundreds of interview questions and solutions are available in our blog at Interview Question Solutions
Solution:

No comments:

Post a Comment