Test case return incorrect result


  • 3
    F

    when input
    'aaa'
    'aa aa aa aa'

    leetcode give true and it should be false I think


  • 0
    Q

    Leetcode is ignoring strings with index greater than last index of pattern.


  • 0

    In the problem statement , it says in the 4th point as

    Each letter in pattern must map to a word with length that is at least 1.
    

    So , when we input "aaa" "aa aa aa aa" => it should return true since every letter mapped ..

    Now , if I test it with "aaa" "aa aa" => LeetCode OJ returned false .
    In reality , even here every letter mapped , only problem is last letter in pattern did not explicitly find an index in "aa aa" .

    In my opinion , the problem statement is ambiguous


  • 0
    Q

    In that case "", "beef" should return true since no letter is unmapped but OJ returns false.


  • 0

    that is why I said problem statement is not clear .


  • 0
    M

    Thanks for pointing out the bug and now it's fixed.


  • 0

    You are welcome :)


Log in to reply
 

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