Skip to content
Veltoryx Technologies
ProProblem 141● Mediumleetcode ↗3 min readUpdated 30 October 2026

Word Break

Determine if a string can be segmented into dictionary words using prefix dynamic programming.

01The problem

Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words.

Note that the same word in the dictionary may be reused multiple times in the segmentation.

Loading the rest of the lesson…