Return true if the query s (no spaces) can be split into a sequence of words from wordList (words reusable).
Signature
canSplit(s: string, wordList: string[]) → boolExample 1
s = "smartspeaker"
wordList = ["smart","speaker","speak"]
output = true
Example 2
s = "catsandog"
wordList = ["cats","dog","sand","and","cat"]
output = false
Constraints
1 ≤ |s| ≤ 3001 ≤ |wordList| ≤ 1000
⌘/Ctrl + Enter runs examples
Run checks the examples. Submit runs every hidden test (17, including large inputs that catch slow solutions).