"Dog" Test Case Wrong?


  • 2
    K

    ["dog"],isUnique("dig"),isUnique("dug"),isUnique("dag"),isUnique("dog"),isUnique("doge")

    This should return [true, true, true, true, true]. I don't understand why it will be [false, false, false,true,true]


  • -1
    W

    d1g exists but dig/dug are not in the dictionary, so it returns false.


  • 0
    T

    But in the example it says:

    Given dictionary = [ "deer", "door", "cake", "card" ]
    
    isUnique("dear") -> false
    isUnique("cart") -> true
    isUnique("cane") -> false
    isUnique("make") -> true
    

    "make" is not in the given dictionary but it returns true.


  • 0
    N

    Based on the given example, I think the test case is right. But description should be more detailed. Take a look at case isUnique("cane") -> false, it keeps same abbr with cake but the result is false. I seems that if current word has the same abbr with some word in dict, they should be same word.


Log in to reply
 

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