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 challengesRising Islands

Gamified challenge · Union-find

Rising Islands

The sea is an m × n grid, all water at first. adds[k] = [r, c] turns cell (r, c) into land at step k (a cell may be named again; it just stays land). An island is a group of land cells joined up, down, left or right.

Write islandsOverTime(m, n, adds) (Python: islands_over_time) that returns a list with the number of islands after each step, so it has one number per entry of adds.

Example: m = 3, n = 3, adds = [[0, 0], [0, 1], [1, 2], [2, 1]] → [1, 1, 2, 3]. Cell (0, 1) joins the first island, and (1, 2) only touches (0, 1) diagonally, so it starts a new one.

Sign in to play Rising Islands

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