How is this a wrong answer???


  • 0
    D
    public boolean wordBreak(String s, Set<String> dict) {
    
        for (String word : dict) {
        int b = s.indexOf(word, 0);
            if(b != -1){
                return true;
            }
            
        } 
        return false;
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.