Leetcode 1002查找常用字符 -python之美

在这里插入图片描述

class Solution:
    def commonChars(self, A: List[str]) -> List[str]:
		res = []
		min_lenth_char = min(A,key = len)
		for char in min_length_char:
			if all(char in item for item in A):
				res.append(char)
				A = [i.replace(char,'',1) for i in A]
		return res

猜你喜欢

转载自blog.csdn.net/weixin_43812609/article/details/109105923
今日推荐