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 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.
Sample Input:
"leetcode", ["leet", "code"]
Sample Output:
true
Hints
Hint 1
Use dynamic programming
Hint 2
dp[i] = true if s[0..i-1] can be segmented
Hint 3
Check all possible word endings at each position
Code Editor
Reset
Run
Save
Loading...