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 challengesShip Capacity Planner

Gamified challenge · Binary search on the answer

Ship Capacity Planner

Crates weights[0], weights[1], … wait on the dock in that order. Each day one ship sails, loaded with the next crates in the queue as long as their total stays within its capacity; crates can't be split or reordered. Everything must ship within d days.

Write minCapacity(weights, d) that returns the smallest ship capacity that clears the dock in at most d days.

Example: weights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], d = 5. Capacity 15 works: [1, 2, 3, 4, 5], [6, 7], [8], [9], [10]. Capacity 14 would need 6 days, so the answer is 15.

Sign in to play Ship Capacity Planner

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