题目
题意
Given an array A of strings made only from lowercase letters, return a list of all characters that show up in all strings within the list (including duplicates). For example, if a character occurs 3 times in all strings but not 4 times, you need to include that character three times in the final answer.
You may return the answer in any order.
思路
每个字符串都仅由26个小写字母组成。那么,创建若干个长度为26的数组,统计每个字符串中每个字母出现的次数。然后再顺序统计全部字符串中同一个字符出现次数最少的个数,即为该字符的共同出现次数。
代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|