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 challengesParking Lot Escape

Gamified challenge · BFS over states

Parking Lot Escape

lot is 6 strings of 6 characters: . is an empty space and each letter is one car (2 or 3 cells long, in a straight line). A car lying across a row only drives left and right; a car lying along a column only drives up and down. Car A is your red car, lying across its row; the exit is on the right edge of that row.

A move slides one car any number of cells along its lane, through empty spaces only, and is written "<car> <direction> <cells>", like "B U 1" or "A R 3". Write freeCar(lot) (Python: free_car(lot)) that returns the moves, as few as possible, after which A touches the right edge. Any shortest list passes; return [] if A is already there. Every lot can be solved.

Example: in ["......", "......", "AA..B.", "....B.", "......", "......"], car B blocks the way. Two moves are enough: ["B D 1", "A R 4"] (or ["B U 2", "A R 4"]).

Sign in to play Parking Lot Escape

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