金鱼的尾巴残了,怎么回事?# pets - 心有所宠
l*y
1 楼
given a Collection words, return a Collection of anagrams
found in the given collection for example "The rat fell in the tar" =>
returned [rat tar]
Requirement:
O(n k lg k) where n is the number of words and k is the average length of
the word
sorting is O(n k lg k) , then in order to how all anagrams, how to make it
under
O(n k lg k) ?
Thanks!
found in the given collection for example "The rat fell in the tar" =>
returned [rat tar]
Requirement:
O(n k lg k) where n is the number of words and k is the average length of
the word
sorting is O(n k lg k) , then in order to how all anagrams, how to make it
under
O(n k lg k) ?
Thanks!