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

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More Dynamic Programming problems