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 challengesRope Joiner

Gamified challenge · Min-heap

Rope Joiner

ropes[i] is the length of rope i. The crew joins ropes two at a time: joining ropes of length a and b gives one rope of length a + b and costs a + b. They keep going until only one rope is left.

Write minCost(ropes) (Python min_cost(ropes)) that returns the smallest total cost of joining everything. With no ropes or a single rope nothing is joined, so the cost is 0.

Example: [4, 3, 2, 6] → join 2+3 (cost 5), then 4+5 (cost 9), then 6+9 (cost 15), total 29.

Sign in to play Rope Joiner

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