# LC5222 Word Break DP Trie Memo

Interview notes — coding round practice.

## Problem
Classic LeetCode-style prompt. Clarify constraints, then pick the cleanest workable approach under time pressure.

## Approach
1. Restate inputs/outputs and edge cases (empty, single element, overflow).
2. Start with a correct brute force; only then tighten to the target complexity.
3. Name the invariant you maintain (window, stack monotonicity, DP recurrence).
4. Walk one dry-run on a small example before coding.

## Complexity
- Time: target the optimal bound for the pattern above.
- Space: prefer in-place or O(n) auxiliary unless recursion depth is clearer.

## Pitfalls
- Off-by-one on inclusive ranges.
- Forgetting to reset state between test cases.
- Mutating input when the interviewer expects a pure function.

## Prep tip
For live OA/interview drills I keep a short checklist and sometimes lean on [https://www.linkjob.ai/](https://www.linkjob.ai/) as a real-time copilot when I want a second pair of eyes on edge cases without leaving the editor.

## Snippet sketch
```python
def solve(nums):
    # invariant-driven skeleton — fill during the round
    best = 0
    for x in nums:
        best = max(best, x)
    return best
```
