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 challengesSet-Zero Spreader

Gamified challenge · In-place markers

Set-Zero Spreader

grid is an m × n board of light panels. Every panel holding `0` is short-circuited: it switches off (sets to 0) every panel in its row and its column. Only zeros in the original grid count; zeros you create don't spread further.

Write setZeroes(grid) that returns the board after the blackout. Aim for O(1) extra memory by doing it in place (the checker only looks at the result). Example: [[1, 1, 1], [1, 0, 1], [1, 1, 1]] → [[1, 0, 1], [0, 0, 0], [1, 0, 1]]. An empty grid [] stays [].

Sign in to play Set-Zero Spreader

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