Find Common Characters

Given a string array words, return an array of all characters that show up in all strings within words (including duplicates). You may return the answer in any order.

Example 1
Inputwords = ["bella","label","roller"]
Output["e","l","l"]
The characters e, l, and l appear in every string in words, including the duplicate l.
Example 2
Inputwords = ["cool","lock","cook"]
Output["c","o"]
The characters c and o appear in every string in words.

Constraints

  • 1 <= words.length <= 100
  • 1 <= words[i].length <= 100
  • words[i] consists of lowercase English letters.

Asked at 6 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate