Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Find Common Characters

XPChallenge Points: 10
levelLevel: Easy

You are given a list of strings.
Your task is to find every character that appears in all the given strings, counting duplicates as well.

If a character occurs multiple times in each word, it must be included that many times in the final result.
Return the collection of shared characters in any order.

Example 1:

Input: words = ["banana", "bandana", "cabana"]

Output: ["a", "a", "n", "n"]

Explanation:

All words contain 'a' at least 3 times and 'n' at least 2 times → pick minimum from each.

Example 2:

Input: words = ["abc", "bcd", "cde"]

Output: ["c"]

Explanation:

Only the letter 'c' appears in all strings.

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result