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 challengesRocky Grid Paths

Gamified challenge · Grid dynamic programming

Rocky Grid Paths

grid[r][c] is 0 for an open tile and 1 for a rock. A hiker starts on the top-left tile and must reach the bottom-right tile, moving only right or down, one tile at a time, never onto a rock.

Write paths(grid) that returns how many different routes there are. For [[0, 0, 0], [0, 1, 0], [0, 0, 0]] the answer is 2: around the rock along the top, or along the left. If the start or the exit is a rock, the answer is 0.

The grid has at least one tile and at most 16 rows and 16 columns, so the answer fits in an int.

Sign in to play Rocky Grid Paths

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