DevHireLab
TutorialsBootcamp
Problems
Code SimulatorAI InterviewSoonContact
DevHireLab
TutorialsBootcamp
Problems
Code SimulatorAI InterviewSoonContact
Back to Arena
easy
Two Pointer

Valid Palindrome

**Problem Statement:** A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers. Given a string `s`, return `true` if it is a palindrome, or `false` otherwise. **Hint / Expected Approach:** Skip non-alphanumeric, case-insensitive compare **Edge Cases to Consider:** - (1) Empty string - (2) Single character - (3) String with only spaces/punctuation

Examples

Example 1
Input: "A man, a plan, a canal: Panama"
Output: True
Example 2
Input: "race a car"
Output: False
Example 3
Input: " "
Output: True

Constraints

  • ▪1 <= data.length <= 10^5
  • ▪Memory complexity must be O(1) or O(k)
  • ▪Ensure non-overlapping pointer access

Watch Out For Edge Cases

  • ▪Empty string
  • ▪Single character
  • ▪String with only spaces/punctuation
Frequently Asked At
AmazonMicrosoftMetaAppleTCS