Code
The highlighted line runs next. The pill shows the live values in the running call.
Variables
The data structures the code is building
The string
Dashed box = substring being tested; gold bracket = palindrome just counted
Given a string s, return how many of its substrings are palindromes. Substrings at different positions count separately, even if they contain the same letters.
The highlighted line runs next. The pill shows the live values in the running call.
The data structures the code is building
Dashed box = substring being tested; gold bracket = palindrome just counted
n = len(s). The highlighted row is the solution being traced.
Keyboard: ← → step, Space play or pause. Letters and digits; drawings use at most 9 characters for brute force, 10 for the DP table and 16 for expand around centre.