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 challengesAll Mouse Routes

Gamified challenge · Backtracking

All Mouse Routes

maze is a list of equal-length strings: M is the mouse, C the cheese, # a wall and . a free tile. The mouse moves up, down, left or right onto free tiles and may never step on the same tile twice in one route. A route ends as soon as it reaches the cheese.

Write countRoutes(maze) (Python: count_routes(maze)) that returns how many different routes lead from M to C. Two routes are different if they visit different tiles or the same tiles in a different order. If the cheese can't be reached, return 0.

Example: in the open 3 × 3 room ["M..", "...", "..C"] there are 12 routes.

Sign in to play All Mouse Routes

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