Word Break II
Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in any order.

30:00

Word Break II
hard
Topics
Companies

Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in any order.

Example 1:
Input: {"s":"catsanddog","wordDict":["cat","cats","and","sand","dog"]}
Output: ["cats and dog","cat sand dog"]
Constraints:
  • 1s.length201 \leq s.\text{length} \leq 20

  • 1wordDict.length10001 \leq \text{wordDict.length} \leq 1000

  • 1wordDict[i].length101 \leq \text{wordDict}[i].\text{length} \leq 10

  • s and wordDict[i] consist of only lowercase English letters.

  • All strings in wordDict are unique.

Input
arr ={"s":"catsanddog","wordDict":["cat","cats","and","sand","dog"]}

Breaking "catsanddog" using dictionary: [cat, cats, and, sand, dog]

Input String

c

0

a

1

t

2

s

3

a

4

n

5

d

6

d

7

o

8

g

9
Dictionary
cat
cats
and
sand
dog
Found Sentences (0)

No sentences found yet...

Position: 0
Found: 0
Variables
No variables to display
DepthFunction Call
Stack empty
0/9