Leetcode 140. Word Break II
Given a string s and a word dictionary, return all possible sentences formed by inserting spaces so every token is a dictionary word — i.e., enumerate all valid segmentations. The challenge is to generate all combinations efficiently by exploring prefixes and using memoization/DP to avoid exponential rework and prune impossible splits.
Asked at:
Bloomberg
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Early August, 2026
Senior
Late June, 2026
Senior
Late October, 2025
Junior
Hello Interview Premium
Your account is free and you can post anonymously if you choose.