Question about test case?


  • 0
    K

    I have a question about the test case:

    test case

    Input:

    "eecs"

    "electronicengineeringcomputerscience"

    Output: true

    Expected: false

    Why this case is false? The substring "eeri" fits the pattern "eecs" I think. Can anyone point out where I misunderstand this problem? Thank you!


  • 0

    "electronicengineeringcomputerscience" doesn't fit the "eecs" pattern as it doesn't start with something appearing twice. Something like "electronicelectroniccomputerscience" would fit.


  • 0
    K

    But the question says "there is a bijection between a letter in pattern and a non-empty substring in str". I find the non-empty sub-string "eeri" fit the pattern.


  • 0

    No, "eeri" isn't even a substring. Only a subsequence.

    You're misunderstanding the question. A fitting bijection for the example pattern = "abab", str = "redblueredblue" is a -> "red", b -> "blue".


  • 0
    K

    Oh, I see. Thanks:D


Log in to reply
 

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