Leetcode 1002查找常用字符 -python之美 喜欢ヅ旅行 2022-12-15 11:03 2阅读 0赞 ![在这里插入图片描述][watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzgxMjYwOQ_size_16_color_FFFFFF_t_70_pic_center] 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 [watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzgxMjYwOQ_size_16_color_FFFFFF_t_70_pic_center]: /images/20221123/67772995031a40fa979db40143a3c6c9.png
还没有评论,来说两句吧...