โ† Wells Fargo questions

Check if two collections of strings are anagrams

Filed under Wells Fargo

Free read 2 of 3

Confirm if collections mean concatenated single strings or multiset comparison of all elements combined.

The question

Given two collections of strings, write code to check whether they are anagrams of each other (i.e., contain the exact same characters with the same frequencies, considering either all strings concatenated or element-wise).

Constraints

  • Collections can contain strings of varying lengths.
  • Character set is typically lowercase English alphabets.

Examples

Input
list1 = ["listen", "silent"], list2 = ["enlist", "tinsil"]
Output
True
Why
Concatenating or matching the character frequencies across the collections yields identical counts.

Approach

  1. Confirm if collections mean concatenated single strings or multiset comparison of all elements combined.

Solution

O(N + M) time where N and M are total characters, O(1) space for fixed alphabet

Python
from collections import Counter

class Solution:
    def checkAnagramCollections(self, list1: list[str], list2: list[str]) -> bool:
        c1, c2 = Counter(), Counter()
        for s in list1: c1.update(s)
        for s in list2: c2.update(s)
        return c1 == c2

Tips

  • What they are testing: Test empty collections, mismatched total character counts, and case sensitivity.
  • Common mistake: Assuming individual string mapping instead of aggregating all characters across the collections.

Related Wells Fargo questions

Collected from public candidate posts and coding forums. Updated Nov 2026.