Search
⌘K

Leetcode 3472. Longest Palindromic Subsequence After at Most K Operations

Given a string s and a budget k of single-step cyclic letter shifts (each operation moves a character to its next or previous letter, wrapping a↔z), find the maximum length of a palindromic subsequence you can obtain with at most k operations. Core challenge: dynamic programming over pairs to maximize palindrome length under a global cost constraint where the cost to match two chars is their minimal cyclic distance.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.