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 challengesPeg Jump Triangle

Gamified challenge · Backtracking

Peg Jump Triangle

The board is a triangle with rows rows (1 to 5, so at most 15 holes). Holes are numbered row by row from the top: row 0 is hole 0, row 1 is holes 1 2, row 2 is 3 4 5, and so on. Every hole has a peg except the ones listed in empty.

A jump moves a peg over an adjacent peg, in a straight line along a row or either diagonal, into the empty hole just beyond; the jumped peg is removed. Write jumpPegs(rows, empty) that returns jumps as [from, to] pairs that leave exactly one peg. Any winning sequence passes. If the board can't be won, or already has a single peg, return an empty list.

Example: on 4 rows with empty = [1], the first jump could be [6, 1] (hole 6 over hole 3 into hole 1).

Sign in to play Peg Jump Triangle

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