FastPrepValid Palindrome After Normalization
Problems/Valid Palindrome After Normalization

Valid Palindrome After Normalization

Kotak Mahindra Bank logoKotak Mahindra Bank● EasyFULLTIMEONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: The source report identifies the linked Valid Palindrome task. The callable signature, examples, and execution bounds reuse the equivalent reviewed FastPrep task; estimated source fidelity is 95%.

Given a string s, determine whether its letters and digits form a palindrome when letter case is ignored.

Normalize the string conceptually using these rules:

  • Keep only ASCII letters A through Z, a through z, and digits 0 through 9.
  • Treat uppercase and lowercase versions of a letter as equal.
  • Keep the retained characters in their original order. Do not rearrange them or delete any retained letter or digit.

Return true if the retained sequence reads identically in both directions, and false otherwise. An empty retained sequence is a palindrome.

Function

isValidPalindrome(s: String) → boolean

Examples

Example 1

s = "A!b?b,a"return = true

Filtering punctuation and folding case gives abba, whose two outer pairs match.

Example 2

s = "0P"return = false

The digit 0 must be retained. The normalized sequence 0p has different outer characters.

Constraints

  • 0 <= s.length <= 20000.
  • Each character is printable ASCII, with a code from 32 through 126, inclusive.

More Kotak Mahindra Bank problems

  • Best Time to Buy and Sell StockONSITE INTERVIEW · Seen Nov 2026
  • Best Time to Buy and Sell Stock IIONSITE INTERVIEW · Seen Nov 2026
  • Maximum Non-Adjacent Coins in Two RowsONSITE INTERVIEW · Seen Oct 2026
All Kotak Mahindra Bank interview questionsSee Kotak Mahindra Bank hiring insights
Saved
class Solution {
    public boolean isValidPalindrome(String s) {
        // Write your code here
    }
}
Checking account…