Home
Topics
Practice
Roadmap
DSA Tracker
Code Editor
Tech Blogs
More
Sign in
Get started
Loading question...
Feedback
Word Break
Medium
00:00
0 users online
Share
Description
Solution
Submissions
Discussion
Given a string and a dictionary of words, determine if the string can be segmented into a space-separated sequence of dictionary words.
Sample Input:
"leetcode", ["leet","code"]
Sample Output:
true
Hints
Hint 1
Use dynamic programming to track which positions can be reached
Hint 2
DP[i] is true if substring s[0:i] can be segmented
Hint 3
Check all possible word lengths at each position
Code Editor
Reset
Run
Save
Loading...