Word Break Problem
Problem Statement
Given a string
and a set of non-empty words
, determine if
can be segmented into a sequence of words in
.
Rules and Constraints
- The string is composed solely of lowercase English letters.
- The input string may or may not contain spaces between words.
- The set contains unique words composed solely of lowercase English letters.
- It is guaranteed that all characters of and all words in are valid English letters.
- The words in may be of varying lengths.
- Each word in corresponds to a valid English word.
- The set is not empty, and it does not contain the empty string.
- The function should return if can be segmented into a sequence of words in , and otherwise.
Output Requirements
- Return a boolean value ( or ) indicating whether can be segmented into a sequence of words in .
Example
Input: {"input_data":[1,2,3]}
Output: [1,2,3]