Palindrome Partitioning, traced one call at a time

Phase 1 fills a table that says which substrings are palindromes. Phase 2 cuts the string from left to right: each call tries every next piece that starts at start, keeps it only if the table says it is a palindrome, and recurses on the rest.

Try:
CALL
1 / 1

Code

The highlighted line runs next. The pill shows the live values in the running call.

Recursion tree

Hover a partition in res to find its call · edges show the piece cut

not called yet running now paused, waiting on a child call whole string cut (saved) finished piece is not a palindrome

Call stack

Top frame runs; the rest are paused

Variables

s cut into pieces; the bracketed range is the piece being considered

pal table

path pieces cut so far

res

Keyboard: ← → step, Space play or pause. Use up to 8 letters. In the table, the amber ring is the cell being filled and the blue ring is the inner cell it depends on.