šŸ”„ Longest Palindromic Substring

Dynamic Programming Approach Visualization

šŸ“ Custom Input

Quick Examples:
Current Input: babad
Expected Output: bab (or aba)
False (Not Palindrome)
True (Palindrome)
Current Cell
Checking
Input String
Current Range
Max Palindrome
DP Table: dp[j][i] = is substring from j to i a palindrome?
Character Comparison
Current Longest Palindrome
Not found yet
Length: 0
Step 0 of 0

Step 0: Ready to Start

Use the slider or +/- buttons to step through the Dynamic Programming algorithm.

šŸ“Š Algorithm State

Current i: 0
Current j: 0
Max Length: 1
String Length: 5

šŸ“ Algorithm Info

Approach: Dynamic Programming

Time Complexity: O(n²)

Space Complexity: O(n²)

Table Size: 5Ɨ5

Key Insight: dp[j][i] = true if s[j] == s[i] AND (i-j ≤ 2 OR dp[j+1][i-1] is true)