Word Break II
Try to solve the Word Break II problem.
We'll cover the following
Statement
You are given a string, s
, and an array of strings, word_dict
, representing a dictionary. Your task is to add spaces to s
to break it up into a sequence of valid words from word_dict
. We are required to return an array of all possible sequences of words (sentences). The order in which the sentences are listed is not significant.
Note: The same dictionary word may be reused multiple times in the segmentation.
Constraints:
-
s.length
-
word_dict.length
-
word_dict[i].length
-
s
andword_dict[i]
consist of only lowercase English letters. -
All the strings of
word_dict
are unique.
Create a free account to view this lesson.
Continue your learning journey with a 14-day free trial.
By signing up, you agree to Educative's Terms of Service and Privacy Policy