Hard · Dynamic Programming

Valid Palindrome III

Given a string s and an integer k, return true if s is a k-palindrome, meaning it can become a palindrome by deleting at most k of its characters, and false otherwise.

Examples

Example 1

s = "abcdeca", k = 2

Output: true (2 ≤ 2)

Example 2

s = "abbababa", k = 1

Output: true (1 ≤ 1)

Rebuild it in the studio

Core interview problems are free with a full runner and lessons; Pro opens the complete library.

More Dynamic Programming problems