Word Break
Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words.
Solution1
DP
1 | public boolean wordBreak(String s, List<String> wordDict) { |
BFS
1 | public boolean wordBreak(String s, List<String> wordDict) { |