【文件属性】:
文件名称:leetcode苹果-word-break:断字
文件大小:1KB
文件格式:ZIP
更新时间:2021-06-30 19:22:19
系统开源
leetcode
苹果断字
给定一个非空字符串
s
和一个包含非空单词列表的字典
wordDict,确定
s
是否可以被分割成一个或多个字典单词的空格分隔序列。
笔记:
字典中的同一个词可能会在切分中重复使用多次。
您可以假设字典不包含重复的单词。
Example
1:
Input:
s
=
"leetcode",
wordDict
=
["leet",
"code"]
Output:
true
Explanation:
Return
true
because
"leetcode"
can
be
segmented
as
"leet
code".
Example
2:
Input:
s
=
"applepenapple",
wordDict
=
["apple",
"pen"]
Output:
true
Explanation:
Return
true
because
"applepenapple"
can
be
segmented
as
"apple
pen
apple".
Note
that
you
are
allowed
to
reuse
a
dictionary
word.
E
【文件预览】:
word-break-master
----README.md(3KB)