设置一个Map和一个Set。Map是从缩写到原单词(数组)的映射。Set盛装所有仍需要进一步求缩写的原单词,初始化的时候则装所有的原单词。
在每次循环中,把Set里所有的单词都求其缩写加入Map,清空Set。然后查看Map的所有元素,对于那些仍然对应多个原单词的缩写,就把这些原单词加入Set。清空Map。
重复这样的循环直至Set不再有元素。
GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||
GeezerVison is showing github.com — LeetCode/String/527.Word-Abbreviation at master · wisdompeak/LeetCode Expand file tree/ Copy path527.Word-Abbreviation/Directory actionsMore optionsMore optionsDirectory actionsMore optionsMore options/ Copy path527.Word-Abbreviation/Folders and files
设置一个Map和一个Set。Map是从缩写到原单词(数组)的映射。Set盛装所有仍需要进一步求缩写的原单词,初始化的时候则装所有的原单词。 在每次循环中,把Set里所有的单词都求其缩写加入Map,清空Set。然后查看Map的所有元素,对于那些仍然对应多个原单词的缩写,就把这些原单词加入Set。清空Map。 重复这样的循环直至Set不再有元素。 | |||||||||||||||||||||
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. | |||||||||||||||||||||