Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.
For example, given
s = "myinterviewtrainer", dict = ["trainer", "my", "interview"].
1 ( corresponding to
true ) because
"myinterviewtrainer" can be segmented as
"my interview trainer".
0 / 1 ( 0 for false, 1 for true ) for this problem
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.