Given a string target and a list of words, determine whether target can be formed by concatenating one or more words from the list. The same word may be used multiple times.
Input
target: string to form
words: list of available words
Output
True if target can be segmented into words from the list; otherwise false.
Examples
Example 1
Inputtarget = "algomonster", words = ["algo", "monster"]
Outputtrue
Explanation: "algo" + "monster" forms target.
Example 2
Inputtarget = "aab", words = ["a", "c"]
Outputfalse
Constraints
Words may be reused any number of times.
Words contain only lowercase letters.