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 challengesZigzag Banner

Gamified challenge · Simulation

Zigzag Banner

A banner has rows rows. The painter writes text one letter per column: down from the top row to the bottom row, then diagonally back up to the top, then down again, and so on. With one row, the letters just go left to right.

Write zigzag(text, rows) that returns what you read when you take the banner's rows top to bottom, each row left to right, skipping the gaps. For text = "GRANDOPENING" and rows = 2, row 1 has GADPNN and row 2 has RNOEIG, so the answer is "GADPNNRNOEIG".

rows is at least 1 and may be larger than the text; an empty text gives "".

Sign in to play Zigzag Banner

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