FastPrepValid Palindrome
Problems/Valid Palindrome

Valid Palindrome

The Walt Disney Company logoThe Walt Disney Company● EasyFULLTIMEOAPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: The interviewer asked for LC125 using two pointers and then recursion.

The report does not give the input bounds or character set. Here, input may be empty and has at most 500 printable ASCII characters; empty normalized text is a palindrome.

The judged task matches the report at about 90%.

Return whether s reads the same forward and backward after ignoring all characters except ASCII letters and digits and treating uppercase and lowercase letters as equal.

The empty string and a string with no letters or digits are palindromes.

Function

isPalindrome(s: String) → boolean

Examples

Example 1

s = "Was it a car or a cat I saw?"return = true

Ignoring spaces, punctuation and letter case gives wasitacaroracatisaw, which reads the same in both directions. Return true.

Example 2

s = "0P"return = false

The normalized characters are 0 and p. They differ, so return false.

Constraints

  • 0 <= s.length <= 500
  • Every character is printable ASCII, with a code from 32 through 126.

More The Walt Disney Company problems

  • Find All Paths for a Name in a File SystemPHONE SCREEN · Seen Nov 2026
  • Resizable Array-Backed Integer SetPHONE SCREEN · Seen Sep 2026
  • Shortest Path with Directional Move CostsPHONE SCREEN · Seen Sep 2026
All The Walt Disney Company interview questionsSee The Walt Disney Company hiring insights
Saved
class Solution {
    public boolean isPalindrome(String s) {
        // Write your code here
    }
}
Checking account…