Word Break
Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words.

30:00

Word Break
medium
Topics
Companies

Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words.

Example 1:
Input: {"s":"leetcode","wordDict":["leet","code"]}
Output: true
Constraints:
  • 1s.length3001 \leq s.\text{length} \leq 300

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

  • 1wordDict[i].length201 \leq \text{wordDict}[i].\text{length} \leq 20

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

  • All strings in wordDict are unique.

Input
arr ={"s":"leetcode","wordDict":["leet","code"]}

Init DP array

l

1

e

2

e

3

t

4

c

5

o

6

d

7

e

8
DP:
0
1
2
3
4
5
6
7
8
leet
code
Variables
VariableValue
i8
DepthFunction Call
Stack empty
0/41