对于字典里每个单词 得到edit distance<=1所有单词(不一定在字典中) 比方说word ==>A,B,C,word then A==>word B==>word C==>word word==>word means if input is A/B/C/word, word is one of those edit distance<=1 and also in the dictionary create a hashMap based on this, one word can map to several words... after the pre-processing then each time u can use O(1) to get the result
【在 l*****a 的大作中提到】 : 对于字典里每个单词 : 得到edit distance<=1所有单词(不一定在字典中) : 比方说word ==>A,B,C,word : then A==>word : B==>word : C==>word : word==>word : means if input is A/B/C/word, word is one of those edit distance<=1 and also : in the dictionary : create a hashMap based on this,
c*y
13 楼
这空间复杂度是不是一下就多了平均字长倍?这算是做index了吧。
【在 a**********0 的大作中提到】 : 有道理啊 那就是 constant的时间复杂度了 : : also