S**Y 发帖数: 136 | 1 a list of words, given one word, such as "sun", get all the words which
contains all the characters of "sun" in the list.
这个,板上的题目,看有大虾说以前讨论过?谁能给个思路?谢谢。 | r**u 发帖数: 1567 | 2 就直接搞个array[26],每个array[word[i]]++,然后check array['s'], array['u'],
array['n']是不是 > 0。
O((k + m) * n), len(word) = m, len(pattern) = k, num(words) = n。
【在 S**Y 的大作中提到】 : a list of words, given one word, such as "sun", get all the words which : contains all the characters of "sun" in the list. : 这个,板上的题目,看有大虾说以前讨论过?谁能给个思路?谢谢。
|
|