For testcase input: "abcd" pattern: "d*", why is expected answer false?

  • 0

    For the testcase, "abcd" and pattern "d*", why is the expected answer false if '*' matches 0 or more of the preceding element. In this case shouldn't the expected answer be true?

  • 0

    First you should know that p must completely match s
    so 'd*' matches '' 'd' 'dd' 'ddd....'
    there is nothing matches 'abc'
    so false.
    deal with it~

Log in to reply

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