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 challengesCell Life Simulator

Gamified challenge · Neighbour counting

Cell Life Simulator

cells is a lab dish: 1 is a live cell and 0 an empty spot. Each spot has up to 8 neighbours (up, down, left, right and the 4 diagonals); spots beyond the edge count as empty.

Every spot changes at the same moment, based only on the current dish: a live cell with 2 or 3 live neighbours survives, any other live cell dies; an empty spot with exactly 3 live neighbours becomes live, otherwise it stays empty.

Write nextGen(cells) that returns the dish one generation later (same shape). Example: the vertical bar [[0,1,0],[0,1,0],[0,1,0]] becomes the horizontal bar [[0,0,0],[1,1,1],[0,0,0]]. An empty dish [] stays [].

Sign in to play Cell Life Simulator

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