FastPrepValidate a Palindrome After Limited Deletions
Problems/Validate a Palindrome After Limited Deletions

Validate a Palindrome After Limited Deletions

Meta logoMeta● MediumFULLTIMEPHONE SCREENONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: The judged core task combines the stated one-deletion exercise with its stated k-deletion follow-up and matches the visible source at about 99%.

Given a string s and a nonnegative integer k, return true if deleting at most k characters can make s a palindrome. The remaining characters keep their original order.

The empty string and every one-character string are palindromes. Character comparisons are case-sensitive.

Function

isValidPalindrome(s: String, k: int) → boolean

Examples

Example 1

s = "abca"k = 1return = true

Delete either b or c to obtain a palindrome.

Example 2

s = "abcdeca"k = 2return = true

Deleting b and e leaves acdca.

Example 3

s = "abc"k = 1return = false

Deleting one character leaves two different characters.

Constraints

  • k is nonnegative.
  • s may be empty.
  • The input is compared as a sequence of case-sensitive characters.

More Meta problems

  • Count Events in Rolling Minute WindowsPHONE SCREEN · Seen Oct 2026
  • Valid Word AbbreviationPHONE SCREEN · Seen Oct 2026
  • Shortest Path in a Binary MatrixPHONE SCREEN · Seen Sep 2026
All Meta interview questionsSee Meta hiring insights
Saved
class Solution {
    public boolean isValidPalindrome(String s, int k) {
        // Write your code here.
    }
}
Checking account…