← Questions

Word break II: every way to split a sentence

0
AmazonCodingLast asked Jan 2026

Given a string and a dictionary of words, return every sentence you can form by splitting the string into dictionary words, with words separated by spaces. Words may be reused. Memoize so shared suffixes are not solved twice, and discuss how large the output can get.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding