Search⌘ K
AI Features

Solution: Binary Tree Right Side View

Solution: Binary Tree Right Side View asks you to return a list of the nodes visible from the right side of a binary tree, one representative for each depth.

Statement

You are given a root of a binary tree that has n number of nodes. You have to return the right-side view in the form of a list.

A right-side view of a binary tree is the data of the nodes that are visible when the tree is viewed from the right side.

Constraints:

  • 0≤0 \leq
...