<awangdev>139. Word Break_1.java
public boolean wordBreak(String s, List<String> dict) {
        Set<String> words = new HashSet<>(dict);
        
        int n = s.length(); 
        boolean[] dp = new boolean[n + 1];
        dp[0] = true; 

        for (int i = 1; i <= n; i++) {
            for (int j = 0; j < i; j++) {
                dp[i] |= dp[j] && words.contains(s.substring(j, i));
                if (dp[i]) break;
            }
        }
        
        return dp[n];
    }
public boolean var_0 ( String var_2 , List < String > var_4 ) {
  Set < String > var_7 = new HashSet < > ( var_4 ) ;
  int var_9 = var_2 . length ( ) ;
  boolean [ ] var_12 = new boolean [ var_9 + 1 ] ;
  var_12 [ 0 ] = true ;
  for ( int var_13 = 1 ;
  var_13 <= var_9 ;
  var_13 ++ ) {
    for ( int var_15 = 0 ;
    var_15 < var_13 ;
    var_15 ++ ) {
      var_12 [ var_13 ] |= var_12 [ var_15 ] && var_7 . contains ( var_2 . substring ( var_15 , var_13 ) ) ;
      if ( var_12 [ var_13 ] ) break ;
    }
  }
  return var_12 [ var_9 ] ;
}
