@@ -0,0 +1,1282 @@
+package leetcode.oj.wordBreak;%0A%0Aimport java.util.Arrays;%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0A/**%0A * Created by mark on 2/11/14.%0A */%0A%0A//http://oj.leetcode.com/problems/word-break/%0A%0Apublic class Solution %7B%0A    public boolean wordBreak(String s, Set%3CString%3E dict) %7B%0A        int length = s.length();%0A        boolean%5B%5D can = new boolean%5Blength+1%5D;%0A        can%5B0%5D = true;%0A        for (int i = 1; i %3C= length; i++) %7B%0A            for (int j = 0; j %3C i; j++) %7B%0A                if (can%5Bj%5D && dict.contains(s.substring(j, i))) %7B%0A                    can%5Bi%5D = true;%0A                    break;%0A                %7D%0A            %7D%0A        %7D%0A        return can%5Blength%5D;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        String%5B%5D arg = new String%5B%5D%7B%22cbc%22, %22bcda%22, %22adb%22, %22ddca%22, %22bad%22, %22bbb%22, %22dad%22, %22dac%22, %22ba%22, %22aa%22, %22bd%22, %22abab%22, %22bb%22, %22dbda%22, %22cb%22, %22caccc%22, %22d%22, %22dd%22, %22aadb%22, %22cc%22, %22b%22, %22bcc%22, %22bcd%22, %22cd%22, %22cbca%22, %22bbd%22, %22ddd%22, %22dabb%22, %22ab%22, %22acd%22, %22a%22, %22bbcc%22, %22cdcbd%22, %22cada%22, %22dbca%22, %22ac%22, %22abacd%22, %22cba%22, %22cdb%22, %22dbac%22, %22aada%22, %22cdcda%22, %22cdc%22, %22dbc%22, %22dbcb%22, %22bdb%22, %22ddbdd%22, %22cadaa%22, %22ddbc%22, %22babb%22%7D;%0A        Set%3CString%3E dict = new HashSet%3CString%3E(Arrays.asList(arg));%0A        System.out.println(new Solution().wordBreak(%22bccdbacdbdacddabbaaaadababadad%22, dict));%0A    %7D%0A%7D

add solution