FastPrepValid Palindrome After Normalization
Problems/Valid Palindrome After Normalization

Valid Palindrome After Normalization

Amazon logoAmazon● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Amazon full-time phone screen. The report describes a palindrome coding question and suggests Valid Palindrome as similar practice. Our version takes from that practice problem the rule of keeping only ASCII letters and digits and ignoring case. The report does not say which exact variant was asked. We chose the result for empty input, smaller limits, and the examples. Our version is about 90% the same as the reported question.

You are given a string s. Decide whether its letters and digits form a palindrome when letter case is ignored.

Look only at the characters that remain after these rules:

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

Return true if the kept characters read the same forward and backward, and false otherwise. If no characters are kept, the empty sequence counts as a palindrome.

Function

isValidPalindrome(s: String) → boolean

Examples

Example 1

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

The kept characters are A, b, b and a. Ignoring case gives abba. The first and last letters match, and so do the middle two. So the answer is true.

Example 2

s = "0P"return = false

Both characters are kept: the digit 0 and the letter P. Ignoring case gives 0p. A digit never equals a letter, so the first and last characters differ. The answer is false.

Constraints

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

More Amazon Phone Screen questions

  • LRU Cache for Query ResultsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Course SchedulePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Course Schedule IIPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Minimum Time to Spread Through a GridPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Consistent-Hash Packet RouterPHONE SCREEN · Seen Nov 2026
  • Count Connected ComponentsPHONE SCREEN · Seen Nov 2026
  • Second Largest Distinct ElementPHONE SCREEN · Seen Nov 2026
  • Task SchedulerOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Top K Frequent ElementsOA · PHONE SCREEN · Seen Nov 2026
  • Number of IslandsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Check if a String Is a PalindromeCisco · PHONE SCREENCisco interview questions
  • Halfway Course in a Single TrackCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Reverse a String ManuallyNewgen Software · PHONE SCREEN
  • Reverse a String with Two PointersSnowflake · PHONE SCREENSnowflake interview questions
  • Palindrome with One DeletionWhatNot · PHONE SCREENWhatNot interview questions
  • Valid Word AbbreviationMeta · PHONE SCREENMeta interview questions
  • Reverse a StringPersistent Systems · PHONE SCREEN
  • Minimum Changes for Palindromic BlocksCitadel · OA · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions
  • Valid Palindrome IIBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Reverse String In PlaceThe Walt Disney Company · OA · PHONE SCREENThe Walt Disney Company interview questions

Interview reports that mention this question

  • Amazon Full-Time Interview Timelines: 9 Experiences (Part 2 of 2)
  • Amazon Full-Time SDE Interviews: 9 Experiences (Part 1 of 2)

Amazon interview experiences

  • Amazon Experienced SDE Onsite Questions: 1 Experience
  • Amazon SDE Onsite Interview Questions: 9 Experiences
  • Amazon SDE II and L5 FDE Interview Questions: 4 Experiences
  • Amazon Full-Time OA Problems, Earlier Reports (Part 5 of 5)
See Amazon hiring insights
Saved
class Solution {
    public boolean isValidPalindrome(String s) {
        // Write your code here
    }
}
Checking account…