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EeAACKJMoDAECRRHkAACiSKA8AAEUS5QEAoEiiPAAAFOn/ATuvFuEdpdH8AAAAAElFTkSuQmCC" alt="" />

Be careful : It doesn't have to be divided into 2

 package leetcode;
import java.util.Set;
public class WordBreak11 {
public boolean wordBreak(String s, Set<String> dict) {
if(s==null||s.length()==0||dict==null||dict.size()==0){
return false;
}
int len = s.length();
boolean[] can=new boolean[len+1];
can[0]=true;
for(int i=1;i<=len;i++){
for(int j=0;j<i;j++){
if(can[j]&&dict.contains(s.substring(j,i))){
can[i]=true;
break;
}
}
}
return can[len];
}
}

leetcode--007 word break I More articles about

  1. [LeetCode] 139. Word Break Word splitting

    Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine ...

  2. [LeetCode] 140. Word Break II Word splitting II

    Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add space ...

  3. 【leetcode】Word Break (middle)

    Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separa ...

  4. [Leetcode Week9]Word Break II

    Word Break II Answer key Title source :https://leetcode.com/problems/word-break-ii/description/ Description Given a n ...

  5. [Leetcode Week9]Word Break

    Word Break Answer key Original article , Refuse to reprint Title source :https://leetcode.com/problems/word-break/description/ Description Given ...

  6. 【leetcode】Word Break II

    Word Break II Given a string s and a dictionary of words dict, add spaces in s to construct a senten ...

  7. Leetcode#139 Word Break

    Original address And Word Break II( See this article ) comparison , Just to see if it's possible , There is no need to construct solutions , It's simpler . It's still dynamic planning . Code : bool wordBreak(string s, unordered ...

  8. leetcode 139. Word Break 、140. Word Break II

    139. Word Break Can a string be divided into one or more words in a dictionary . Use dynamic programming ,dp[i] At present, the number of i A place ( In a string, it's actually i-1) Can the ending string be divided into words in the dictionary . j It means by ...

  9. LeetCode 139. Word Break Word splitting (C++)

    subject : Given a non-empty string s and a dictionary wordDict containing a list of non-emptywords, determ ...

  10. leetcode 140. Word Break II ----- java

    Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each ...

Random recommendation

  1. Codeforces Round #377 (Div. 2) B. Cormen — The Best Friend Of a Man( greedy )

      Portal Description Recently a dog was bought for Polycarp. The dog's name is Cormen. Now Polycarp has ...

  2. python logging modular

    1.logging The module provides four components logger: Log class , There are two functions 1) Configure the log level , processor handler, filter filterlogger.setLevel(logging.INFO)logger. ...

  3. 【mysql】 Some specifications for database usage

    One .MySQL The problem is Optimizer for complex SQL Support is not good Yes SQL Standard support is not good Large scale cluster solution is not mature , It mainly refers to middleware ID generator , The whole situation is increasing ID Asynchronous logical replication , Data security issues Online DDL HA The plan is not correct ...

  4. CI frame .htaccess hide url stay index.php Solution

    CodeIgniter( Hereinafter referred to as "CI") Is a foreign excellent PHP Lightweight MVC frame , It supports PHP4 and PHP5. Is the development of small and medium-sized high demand for scalability Web Application tools . The blog you're seeing right now ...

  5. N Program simulation of body motion

    It's still with < Trisomy > An article about . The motion of three stars in space under the action of gravity is called the three body problem , See my last article : Program simulation of three body motion . And this section , The three body problem is extended , In space N There are two stars in the universe ...

  6. QT Of the class ------QLabel

    QLabel Class represents tag , It's a widget for displaying text or images . structure QLabel Class supports the following constructors : [plain] view plaincopy QLabel(QWidget *parent  ...

  7. C Language battle-hardened 22

    /* subject 58: Write a business function , Read file by line . Package the content according to the third memory model and transfer the data out , Pass the number of rows out through the function parameter . There are two function prototypes , Choose any one requirement 1: Please choose your own interface ( function ), And implement the function : ...

  8. ICT What does the test site do , How to set !

    Simple understanding :ICT Like a multimeter , Just replaced the pen with a test needle . So the question is simple , A normal one RLC Components , You have to have two test points to test , Of course, the same network common node with a test point is OK . Detailed description : PCB Design depends on ...

  9. SVN Configuration of

    Xcode It's developers who build Mac OS X The quickest way to apply , And the easiest way to take advantage of the new Apple Technology , and SVN It's version control tools , that Xcode SVN And what is it ? How to configure Xcode SVN? ...

  10. How to force immediate stop of threads in Jmeter servers How to be in jmeter After execution , Stop immediately jmeter

    https://stackoverflow.com/questions/38900315/how-to-force-immediate-stop-of-threads-in-jmeter-server ...