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 challengesMotion Challenge

Gamified challenge · Asked in Capgemini

Motion Challenge

A ball sits on a board with walls and movable blocks, and it has to reach the hole. Each row of board uses # for a wall, . for an empty cell, B for the ball, H for the hole and X for a block. One move slides one piece (the ball or a block) one cell up, down, left or right into an empty cell; only the ball may enter the hole.

Write solve(board) that returns the fewest moves that get the ball into the hole, each as "r c D": the piece's row and column (from 0) before it moves, then U, D, L or R. For ["#H#", "#X.", "#B#"] that's ["1 1 R", "2 1 U", "1 1 U"]: push the block aside, then roll up twice.

Sign in to play Motion Challenge

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