ByteByteGo: Is Palindrome Valid
β’ 32 words β’ 1 min β’ updated
ByteByteGo: Is Palindrome Valid:
python
def is_palindrome_valid(s: str) -> bool:
t = [c for c in s if c.isalnum()]
return t == t[::-1]Remove non-alphanumeric characters, compare the string to its reverse. β
Connections
Shared tags