#3472
Longest Palindromic Subsequence After at Most K Operations
expert · 1055 · lc medium +32 · 37.4% accepted · 120 likes · top 16%
Description
You have string s and integer k. Each operation shifts one character to the adjacent letter in the alphabet (circular: after \'z\' comes \'a\', before \'a\' is \'z\').
With at most k such operations on s, find the longest palindromic subsequence achievable.
Return its length.
Code
1
2
3