I am not quite understand the problem. If I just follow the description from the problem, here is the result I got for the example :["l2e", "god", "i6l", "me", "i6t", "in5l", "i7n", "f2e", "in6n"] which is different from the answer of problem.
Can anyone explain to me why this kind of abbreviation is wrong? Thanks ahead.
Me too. Can someone give some clarification? Why this is not a valid answer? I thought it's better answer...
@qswawrq @si-yao The problem says that " In other words, a final abbreviation cannot map to more than one original words." So in your solution, "i7n" can map to more than one original words ("intension", and "intrusion"). That's why "intension" cannot be abbreviated as "i7n".
@fallcreek Thank you your explanation! Very helpful!
@saket.kumar29 I guess the abbreviation in this problem means a certain word pattern. For example "i7n" has to map to any word in the list which start with 'i', end with 'n' and have 7 more letters in between.
That is also the reason why "internal" and "interval" do not have abbreviations. The only valid word pattern for them is "intern1l" and "interv1l" but both of which will not make the word shorter.
Thanks a lot. Got it.
I had exactly the same question. I was completely confused about the definition of conflict abbreviations. According to my understanding, I thought the abbreviation and its original word is a kind of key->value relation, Once we have distinct abbreviations, it would be OK. So I didn't understand why the output ["l2e","god","i6l","me","i6t","in5l","i7n","f2e","in6n"] was incorrect.
Although the given example indicates there must be something wrong with my understanding, but I didn't know how the abbreviations came from.
@fallcreek Thanks for your explanation
@NoAnyLove I have the same problem still dont understand the sample example it self, I am getting ["l2e","god","i6l","me","i6t","in5l","i7n","f2e","in6n"]
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.