Ctrl K

Letters in Every Word

Easy
You are given an array of words words. Find every letter that appears in all of the words, counting repeats: if a letter occurs at least k times in each word, it must appear exactly k times in the answer. Return these letters (each as a one-character string) in any order.
Example 1
words=['banana', 'cabana', 'anagram'] → ['a', 'a', 'a', 'n']

The letter a appears at least three times in every word, and n at least once; b is missing from one word.

Example 2
words=['sun', 'moon'] → ['n']

Only n is shared, once.

Example 3
words=['dog', 'cat'] → []
Constraints
  • 1 ≤ len(words) ≤ 100
  • 1 ≤ len(words[i]) ≤ 100
  • Words consist of lowercase English letters
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsOne-Row Typing EasyDinner for Two EasyPhrases with Synonyms EasyWord from a License Plate EasyDistinct Morse Signals Easy
loading Python…
Input
words=['banana', 'cabana', 'anagram']
Expected
['a', 'a', 'a', 'n']

Run checks the first 3 tests in your browser. Submit checks all 106 tests on the server, hidden ones included.