1class Solution:2def wordBreak(self, s: str, wordDict: List[str]) -> bool:3memo = {}45def can_construct(target, strings_bank, memo):6if target in memo:7return memo[target]8if target == "":9return True10for (11element12) in (13strings_bank14): # for every element in our dict we check if we can start constructing the string "s"15if (16element == target[0 : len(element)]17): # the remaining of the string "s" (which is the suffix) is the new target18suffix = target[len(element) :]19if can_construct(suffix, strings_bank, memo):20memo[target] = True21return True22memo[target] = False23return False2425return can_construct(s, wordDict, memo)