Algorithm and Complexity

Given an input string and a dictionary of words, find out if the input string can be segmented into a space-separated sequence of dictionary words. See following examples for more details.

Note: you can check whether a word exists in the given dictionary using this method:

bool dictionaryContains(str word), which returns True if the word is contained in the dictionary, and False otherwise

This question has been answered.

Get Answer