Groww Portfolio Tree Right Side View
Groww Portfolio Tree Right Side View
MediumTrees100% accepted
Groww visualizes a user's portfolio as a binary tree. The app shows only the rightmost asset at each depth level. Given the root of a binary tree, return the values of the nodes visible from the right side (one value per level, rightmost at each level).
Approach
Return the right side view of a binary tree.
Input
5
1 2 3 -1 5 -1 4
Output
[1,3,4]
More Trees problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards