Tag: 125 Valid Palindrome

  • LeetCode: 125 Valid Palindrome

    Given a string s, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Example: Input: "A man, a plan, a canal: Panama" Output: true Input: "race a car" Output: false 问题 给定一个字符串 s,判断它是否是一个回文字符串,仅考虑字母数字字符并忽略大小写。 解决方案 1 双指针法 Approach 1 / 方法 1 使用双指针从字符串的两端向中间移动,忽略非字母数字字符,并比较字母数字字符是否相等。 Detailed Steps / 详细步骤…