Word Break 2
medium
1. You are given n space-separated strings, which represents a dictionary of words. 2. You are given another string that represents a sentence. 3. You have to determine if this sentence can be segmented into a space-separated sequence of one or more dictionary words.
Constraints
1 <= number of words <= 10 1 <= length of each word <= 15 1 <= length of sentence <= 1000
Format
Input
A number n n strings representing words A string representing a sentence
Output
Check the sample ouput and question video.
Example
Sample Input
2
pep coding
pepcoding
Sample Output
true