A
示例 1 : 输入:["bella","label","roller"] 输出:["e","l","l"]
示例 2 : 输入:["cool","lock","cook"] 输出:["c","o"]
1 <= A.length <= 100
1 <= A[i].length <= 100
A[i][j]
class Solution: def commonChars(self, A: List[str]) -> List[str]: result, temp = [], set(A[0]) for i in temp: result += min(a.count(i) for a in A) * i return result # 执行用时 :52 ms, 在所有 Python3 提交中击败了84.84%的用户 # 内存消耗 :13.9 MB, 在所有 Python3 提交中击败了100.00%的用户
for
A[0]
set()
temp
i
result