Clean Palindrome
A palindrome can be checked even inside a regular phrase with spaces, punctuation, and mixed letter case. Given a string s, consider only letters and digits, and ignore case. Return True if the cleaned string reads the same from left to right and from right to left, otherwise return False.
Примеры
Ввод
"A man, a plan, a canal: Panama"Вывод
TrueВвод
"race a car"Вывод
FalseВвод
" "Вывод
TrueНужно реализовать
def is_palindrome(s: str) -> bool:
Теги
stringstwo-pointers
Prisijunkite, kad matytumėte pateikimų istoriją
PrisijungtiPrisijunkite, kad naudotumėte DI mentorių
PrisijungtiVisible tests
1
Input
"A man, a plan, a canal: Panama"Expected
True2
Input
"race a car"Expected
False3
Input
" "Expected
True4
Input
"0P"Expected
False5
Input
"ab_a"Expected
True6
Input
"abc"Expected
FalseFocus radio
Paused · SomaFM · Fluid