๐ WAYPOINT LESSON
Palindromic Intervals
โญโญโญ advancedโณ 30 min read๐ Lesson 163 of 281
The longest palindromic subsequence matches the outer chars or drops one side โ an O(n^2) interval DP with no split loop.
Palindromes as intervals
If s[i] == s[j], dp[i][j] = dp[i+1][j-1] + 2; otherwise drop one end. No split loop at all โ the recurrence branches on equality instead of enumerating k. This is the lightest interval DP, and the one whose greedy impostors fail fastest.
โก Now practice
Ready to CodeInterval TrioMatrix-chain multiplication, linear stone merging, and longest palindromic subsequence under a 50-case load.
3 challenges ยท ยท ~110 min