Mirror Check
easyA sign-painting shop offers a discount on phrases that read the same forwards and backwards — ignoring spaces, punctuation, and letter case, since paint doesn't care about commas.
Given the phrase text, return True if, considering only letters and digits and treating uppercase and lowercase as equal, it reads identically in both directions. An empty phrase (or one with no letters or digits at all) qualifies.
Example 1
in text = "Never odd or even"
out True
Filtered and lowercased: "neveroddoreven" — a palindrome.
Example 2
in text = "paint store"
out False
Example 3
in text = "?!"
out True
Nothing alphanumeric to compare — trivially a mirror.
Constraints
- · 0 <= len(text) <= 2 * 10^5
- · text contains printable ASCII characters
solution.py● loading python…
test results
Hit ▶ Run to test your code against the visible cases.