314. Find Common Characters
Easy
Frequency Intersection
Hashing
Problem
Given an array of strings words, return all characters that appear in every string, including duplicates. The result may be returned in any order.
Examples
Example 1
Input: ["bella","label","roller"]
Output: ["e","l","l"]
Example 2
Input: ["cool","lock","cook"]
Output: ["c","o"]
Example 3
Input: ["a","a","a"]
Output: ["a"]
Constraints
� 1 <= words.length <= 100
� 1 <= words[i].length <= 100
� words[i] consists of lowercase English letters.
Hints
?? Count each character in every word.
?? For each character, keep the minimum frequency seen across all words.
Expected Complexity
Time: O(total characters)
Space: O(1)
Follow-up
Can you solve it using only two fixed arrays of size 26?
Practice Notes
Attempts: 0
Time spent: 0min
Hints used: 0
JavaScript
00:00
Loading...
Case 1
Case 2
Case 3
Input
["bella","label","roller"]Expected
["e","l","l"]