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

注意:不一定是一分为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的更多相关文章

  1. [LeetCode] 139. Word Break 单词拆分

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

  2. [LeetCode] 140. Word Break II 单词拆分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 题解 题目来源:https://leetcode.com/problems/word-break-ii/description/ Description Given a n ...

  5. [Leetcode Week9]Word Break

    Word Break 题解 原创文章,拒绝转载 题目来源: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

    原题地址 与Word Break II(参见这篇文章)相比,只需要判断是否可行,不需要构造解,简单一些. 依然是动态规划. 代码: bool wordBreak(string s, unordered ...

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

    139. Word Break 字符串能否通过划分成词典中的一个或多个单词. 使用动态规划,dp[i]表示当前以第i个位置(在字符串中实际上是i-1)结尾的字符串能否划分成词典中的单词. j表示的是以 ...

  9. LeetCode 139. Word Break单词拆分 (C++)

    题目: 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 ...

随机推荐

  1. Java 多态,重载,重写

    1.多态(polymorphism): 多态是指程序中定义的引用变量所指向的具体类型和通过该引用变量发出的方法调用在编程时并不确定,而是在程序运行期间才确定,即一个引用变量倒底会指向哪个类的实例对象, ...

  2. HDU 5889 (最短路+网络流)

    Barricade Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total S ...

  3. Windows查看端口被哪个进程占用

    命令 查看PID: netstat -ano|findstr 端口号 查看进程名称: tasklist|findstr PID 结束进程: taskkill -F -PID PID号 配图详解: 1. ...

  4. Strut2 spring hibernate 整合

    一.创建web项目工程 wzz 点击finish 2.添加spring Jar包   AOP,Core,Persistence Core ,web jar 点击next 点击Finish 3.配置Da ...

  5. 强制设置IE浏览器的版本模式

    转载自:http://blog.csdn.net/huwenhu2007/article/details/17954119 1.<meta http-equiv="X-UA-Compa ...

  6. (转)多个MapReduce作业相互依赖时,使用JobControl进行管理

    原文地址:http://mntms.iteye.com/blog/2086990 要处理复杂关系的数据,一个工程里面绝对不止一个MapReduce作业,当有多个MapReduce作业时,       ...

  7. 第一个元素<flout>写了,想在他的旁边加一个元素.IE6会出现缝隙. 不要用margin撑开,要用flout

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  8. Chapter 1 First Sight——4

    Charlie gave me an awkward, one-armed hug when I stumbled my way off the plane. 当我让我蹒跚的从飞机上下来,查理斯单手给 ...

  9. Quartz总结(四):动态修改定时器二

    前文:http://www.cnblogs.com/LiuChunfu/p/5598806.html 提到了一种动态修改定时器的方法, 其本质就是在job方法中注入Schedular的对象,从Sche ...

  10. 简单三段式状态机实验2-LCD12864

    此实验是在“基于I2C EPPRPM(AT24C02B) + LCD12864实验”基础上,把LCD模块里的一段式状态机改成三段式,I2C EPPROM模块暂时未改出来,一步一步来吧,改完后代码下载到 ...