Leetcode 1246. Palindrome Removal
Given an integer array, repeatedly remove contiguous subarrays that are palindromes and return the minimum number of moves to delete the whole array. This is an interval DP problem: compute minimal removals for each subarray with transitions for splitting and for merging when endpoints can be removed together (matching values).
Asked at:
Yahoo
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Mid January, 2026
Yahoo
Junior
Time‑complexity justification Test cases discussed- "abba", "acbba", "abc", empty string, single character, "abca", "deeee", "racecarx" etc. Extension to k removals- Added recursion/helper tracking remaining removals; worst‑case O(2^k · n). Extension to replacements– Same two‑pointer scan, decrement k on mismatch; O(n) time, O(1) space.
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.