@@ -0,0 +1,1017 @@
+package leetcode.word_break;%0A%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0Apublic class Solution %7B%0A%09public boolean wordBreak(String s, Set%3CString%3E dict, int minlength) %7B%0A%09%09if(dict.contains(s)) return true;%0A%09%09char%5B%5D chars = s.toCharArray();%0A%09%09int len = chars.length;%0A%09%09for(int i = minlength; i %3C= len - minlength; i++)%7B%0A%09%09%09if(dict.contains(s.substring(i)) && wordBreak(s.substring(0, i), dict, minlength))%7B%0A%09%09%09%09return true;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return false;%0A%09%7D%0A    public boolean wordBreak(String s, Set%3CString%3E dict) %7B%0A    %09if(dict.size() == 0) return s.length() == 0;%0A    %09int minlength = -1;%0A    %09for(String word : dict)%7B%0A    %09%09if(minlength == -1 %7C%7C word.length() %3C minlength)%7B%0A    %09%09%09minlength = word.length();%0A    %09%09%7D%0A    %09%7D%0A    %09return wordBreak(s, dict, minlength);%0A    %7D%0A    %0A    public static void main(String%5B%5D args)%7B%0A    %09Set%3CString%3E input = new HashSet%3CString%3E();%0A    %09input.add(%22leet%22);%0A    %09input.add(%22code%22);%0A    %09input.add(%22b%22);%0A    %09System.err.println(new Solution().wordBreak(%22leetcodea%22, input));%0A    %7D%0A%7D

Add java solution for 139. Word Break