type
status
date
slug
summary
tags
category
icon
password
题目:
给你一个字符串数组 words ,请你找出所有在 words 的每个字符串中都出现的共用字符( 包括重复字符),并以数组形式返回。你可以按 任意顺序 返回答案。
来源:力扣(LeetCode)
链接:https://leetcode.cn/problems/find-common-characters
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
示例 1:
示例 2:
提示:
1 <= words.length <= 100
1 <= words[i].length <= 100
words[i]
由小写英文字母组成
思路:
每一个字符串都分割为hashmap的形式,存储每一个字符出现的次数,最小出现次数且不等于0就是公用的
代码:
结果:

image-20220623180255108