wrong test case: isMatch("ab", ".*") → true

  • 0

    Following discussion applies to this problem

    Given the following constraints:
    '.' Matches any single character.
    '*' Matches zero or more of the preceding element.

    This test case does not make sense:
    isMatch("ab", ".*") → true

    '*' should match zero or more of preceding characters, in this case '.' matches 'a' so the expression in effect becomes "a*" which must not match input string "ab".

    This test case needs to be amended to following:
    isMatch("ab", ".*") → false

  • 0

    It's confusing but It's correct.
    This question just defines such a matching pattern and you need to handle it.
    ".*" => ".." => "ab"

Log in to reply

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