423. Valid Palindrome III

Given a string s and an integer k, return true if s is a k-palindrome.

A string is k-palindrome if it can be transformed into a palindrome by removing at most k characters from it.

Example 1:

Input: s = "abcdeca", k = 2

Output: true

Explanation: Remove 'b' and 'e' characters.

Example 2:

Input: s = "abbababa", k = 1

Output: true

Now Your Turn!

Pick the correct output for the given input

Input s = "bacabaaa", k =2

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

1 <= s.length <= 1000

s consists of only lowercase English letters.

1 <= k <= s.length

Hints

Frequently Occurring Doubts

Interview Follow-up Questions

Fun Facts

0
class Solution {
public:
bool isValidPalindrome(string s, int k) {
//User code goes here
}
};
Test Case

Input:

K
S