DescriptionQ049
Q049FWASIC interview problem
Clean palindrome check
TechniquesStringTwo pointers
DifficultyEasy
TopicStrings
LanguageSystemVerilog
Requirements3 checkpoints
01
Problem
Return 1 when a string is a palindrome after ignoring punctuation and letter case. Only alphanumeric characters participate in the comparison.
Example input and output
Use this case to check your interpretationInput
s = "A man, a plan, a canal: Panama!"Output
1 (palindrome)Explanation
Removing punctuation and folding case produces "amanaplanacanalpanama", which reads the same in both directions.
02
Requirements (3)
- Skip non-alphanumeric bytes from both ends.
- Compare letters case-insensitively.
- Treat an empty cleaned string as a palindrome.
