GamifiedGamified challengesPracticeRaceLeaderboardPricing

Learn data structures by watching them move, then doing it yourself. Press M anytime to toggle sound.

A product of Amypo Technologies, Coimbatore.

Learn

  • All topics
  • Learning path
  • How it works
  • About dotprep

Practice

  • Practice arena
  • Daily challenge
  • Gamified challenges
  • Race mode
  • Leaderboard

Interview prep

  • Java interview
  • Coding questions
  • Company questions
  • System design
  • Jobs & careers

You

  • Dashboard
  • Settings
  • Pricing
  • Create account

© 2026 dotprep

Content last updated 20 November 2026

GamifiedGamified challengesPracticeRaceLeaderboardPricing
Log inStart free
Gamified challengesRight-Side Window View

Gamified challenge · Breadth-first search

Right-Side Window View

The building is a binary tree given as tree (a TreeNode root; examples are in level order with null for a missing room). Looking from the right side, on every floor you see only the rightmost room; everything to its left is hidden behind it.

Write rightView(tree) (Python: right_view(tree)) that returns the numbers you see, top floor first. An empty tree returns an empty list.

For [1, 2, 3, null, 5, null, 4] the answer is [1, 3, 4]. For [1, 2, 3, 4] it is [1, 3, 4]: the left wing reaches lower, so its bottom room shows through.

Sign in to play Right-Side Window View

This game is part of the paid plans. Sign in, then pick a plan to write your answer, watch it play out, and step through the algorithm with its guide.

Sign in with Google

or log in with email · create an account