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

Open every published interview problem, solution, scene, and memory room free, with no account.

More Dynamic Programming problems