Word Break
Given a non-empty string s and a dictionary word Dict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words. You may assume the dictionary does not contain duplicate words.
For example, given
s="leetcode"
,
dict=["leet", "code"]
.
Return true because"leetcode"
can be segmented as"leet code"
.
分析
划分型
和前面一题的划分一样,也是sequence。i长度n+1,j等于i-1。条件判断时不取到i
这里得到f[i]为true时就break!!!!!!!!!!!
Last updated