\0 is also a character, why '.' cannot match


  • 0
    Z

    As the problem said, '.' can match any single character, then this is no reason why '.' cannot match '\0', which is the ending character of char *. So I think the description should modified " . can match any single character except \0 character".


  • 1
    M

    The \0 character is not actually a part of the string, it's a signal that the string is done. Since it isn't part of the string, it cannot be part of the pattern, and so '.' doesn't match it.


Log in to reply
 

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