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 challengesWord Break Scanner

Gamified challenge · DP over prefixes

Word Break Scanner

s is a sentence of lowercase letters with no spaces, and words is the scanner's dictionary. Write wordBreak(s, words) (Python word_break) that returns true if s can be cut into pieces that are all dictionary words, in order, with nothing left over, and false otherwise.

A word may be used any number of times. The empty sentence needs no words, so it is true; dictionary words are never empty.

Example: "starfishbowl" with ["sta", "star", "fish", "starfish", "bowl", "fishbowl"] is true (star fish bowl, or starfish bowl), but "redbluegreed" with ["red", "blue", "green", "bluegreen", "reed"] is false.

Sign in to play Word Break Scanner

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