FreeCareerPath
Build the PrimitiveMedium

Binary Tree Right Side View

Write `right_side_view(root)` returning the values visible when looking at the tree from the right, top to bottom. [1,2,3,null,5,null,4] -> [1, 3, 4] Walking down the right spine is the obvious wrong answer: when a right child is missing, the deepest left descendant becomes visible. Take the last node of each BFS level instead.

What to expect: A timer starts when you begin. Edit the starter code, run it against the test suite as many times as you like, then finish when you're done. The reference solution and interviewer follow-up questions unlock only after you finish.

Log in to start this session

Timed sessions and your results for "Binary Tree Right Side View" are saved to your account — logging in takes a few seconds.

Binary Tree Right Side View — FreeCareerPath