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 = longest so far
Given a string s, return its longest substring that reads the same forwards and backwards. If several have the same length, return any of them.
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 = longest so far
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.