Valid Palindrome — Two Pointers
Decide whether a text is a mirror of itself end to end, ignoring capital letters, punctuation and spacing.
Two Pointers · Easy
The problem
Given a string, say whether it reads the same both ways when you ignore case and anything that is not a letter or digit.
What to return
- Return true if s reads the same forwards and backwards, otherwise false.
- Only letters and digits count, and case is ignored. An empty result counts as a palindrome.
Constraints
- 0 ≤ len(s) ≤ 24
- s uses printable ASCII characters only (letters, digits, symbols, spaces)
Example
- Input
s = "No lemon, no melon"- Output
true