dynamic_programming.all_construct

Program to list all the ways a target string can be constructed from the given list of substrings

Functions

all_construct(→ list[list[str]])

returns the list containing all the possible

Module Contents

dynamic_programming.all_construct.all_construct(target: str, word_bank: list[str] | None = None) list[list[str]]

returns the list containing all the possible combinations a string(target) can be constructed from the given list of substrings(word_bank)

>>> all_construct("hello", ["he", "l", "o"])
[['he', 'l', 'l', 'o']]
>>> all_construct("purple",["purp","p","ur","le","purpl"])
[['purp', 'le'], ['p', 'ur', 'p', 'le']]