FastPrepPalindrome with K Deletions
Problems/Palindrome with K Deletions

Palindrome with K Deletions

WhatNot logoWhatNot● HardNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a new grad phone screen at Whatnot as a follow-up to the one-deletion palindrome check, which is its own problem here. The interviewer raised the limit from one deleted character to k. The candidate only had to describe a plan for it.

The report gives no limits. Here, s has up to 1000 lowercase letters and k is between 0 and the length of s.

Our version is about 95% the same as the reported question.

Given a string s and an integer k, return true if s can become a palindrome after deleting at most k characters. Otherwise, return false.

A palindrome reads the same from left to right and right to left. Deleting characters keeps the rest in their original order. Deleting nothing is allowed.

Function

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

Examples

Example 1

s = "abxcbya"k = 2return = true

Delete "x" and "y" to get "abcba", which is a palindrome. That uses 2 deletions.

Example 2

s = "abcd"k = 2return = false

All four letters are different, so a palindrome can keep at most one of them. That takes 3 deletions, more than k = 2.

Example 3

s = "level"k = 0return = true

"level" is already a palindrome, so no deletion is needed.

Example 4

s = "cabbad"k = 1return = false

The ends "c" and "d" differ, so one deletion must remove one of them. Deleting "c" leaves "abbad" and deleting "d" leaves "cabba". Neither is a palindrome.

Constraints

  • 1 <= s.length <= 1000
  • s contains only lowercase English letters.
  • 0 <= k <= s.length

More WhatNot Phone Screen questions

  • Adjacent Pair and Run RemovalPHONE SCREEN · Seen Nov 2026
  • Merge Sorted Squares of Two ArraysPHONE SCREEN · Seen Nov 2026
  • User Journey PathsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Knight Dialer SequencesPHONE SCREEN · Seen Oct 2026
  • Reachable Exits in an Obstacle GridPHONE SCREEN · Seen Oct 2026
  • Palindrome with One DeletionPHONE SCREEN · Seen Oct 2026
  • Search a 2D MatrixPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Attraction Route Without Reusing TrailsPHONE SCREEN · Seen Sep 2026
  • Earliest Car for Each PassengerPHONE SCREEN · Seen Sep 2026
  • Minimum Stores for a Shopping ListPHONE SCREEN · Seen Sep 2026

Similar questions at other companies

  • Concatenated WordsAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Balanced Parentheses with Sequential Left DeletionsGoogle · PHONE SCREENGoogle interview questions
  • Word Break IIWex · PHONE SCREEN
  • Word Break IIInMobi · PHONE SCREENInMobi interview questions
  • Word Break IIBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Word Break II: All SentencesMicrosoft · PHONE SCREEN · ONSITE INTERVIEWMicrosoft interview questions
  • Longest Valid ParenthesesApple · PHONE SCREENApple interview questions
  • Longest Properly Closed Bracket RunAdobe · PHONE SCREENAdobe interview questions
  • Indexed Proximity SearchStripe · PHONE SCREENStripe interview questions
  • Longest Palindromic SubstringSiemens · PHONE SCREEN

Interview reports that mention this question

  • Whatnot SWE New Grad Second Technical Interview: 8 Experiences

WhatNot interview experiences

  • Whatnot interviews · October 2026
  • Whatnot Experienced SWE Phone Screen Questions: 2 Experiences
  • Whatnot SWE Interview Questions: 6 Experiences
All WhatNot interview questionsSee WhatNot hiring insights
Saved
class Solution {
    public boolean isValidPalindrome(String s, int k) {
        // write your code here
    }
}
Checking account…