Why "a" return true and "1a2" return false

  • 1

    from the error I met
    "a" return true
    "1a2" return false

    I am confused about what is the rule for palindrome for this question

  • 8

    Here is a statement in problem description:

    considering only alphanumeric characters

    So, numbers and alphabet are counted.

    In a is 1 character string, it should be a palindrome.

    In 1a2, since digits should be counted, obviously 1 is not 2, the result should be false.

  • 0

    I didn't read it clearly,simply consider alphanumeric as alphabet :(

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.