Sobes.tech
Junior — Middle+

Determining common letters in a set of words

livecode

Task condition

Given an array of strings words. You need to implement a method that returns a list of characters that appear in all strings of the array, considering their count.

Example 1: Input: ["bella", "label", "roller"] Output: ["e", "l", "l"]

Example 2: Input: ["cool", "lock", "cook"] Output: ["c", "o"]

Constraints:

  • 1 ≤ words.length ≤ 100
  • 1 ≤ words[i].length ≤ 100
  • words[i] consists only of lowercase English letters
class Solution {
    public List<String> commonChars(String[] words) {
        
    }
}