Mental Model
We want to split a string into parts where each part is a palindrome, using the fewest cuts possible. We check all possible splits and remember the best results to avoid repeating work.
Analogy: Imagine cutting a ribbon into pieces so that each piece is a perfect mirror image of itself. You want to make as few cuts as possible to get all mirror pieces.
s = "a b a c" Indices: 0 1 2 3 Cuts: between indices Initial: a b a c No cuts: a b a c (not all palindrome) Possible cuts: a | b a | c
