题解 | #回文昵称# 字符串模拟题
回文昵称
https://www.nowcoder.com/practice/5ac63bfdf73c473d9dee7e3294551563
知识点
字符串
思路
按照要求模拟即可,这里用python很方便。
AC Code(python)
#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
#
# @param s string字符串
# @return bool布尔型
#
class Solution:
def isPalindromeNickname(self , s: str) -> bool:
lst = [x for x in s.lower() if x.isalpha() or x.isdigit()]
return lst == lst[::-1]

