Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Anagram grouping of product SKUs

Python data engineering interview problem. Difficulty: intermediate. Pattern: Hashing. About 15 minutes. Part of the Pro drill bank.

Warehouse SKUs are sometimes anagrams of each other (same letters, different order) because of a packing glitch. Group SKUs that share a letter signature.

Group product SKUs that are anagrams of one another.

Requirements

  • SKUs in the same group share the same sorted-letter key.
  • SKUs that are not anagrams stay in different groups.

Constraints

  • skus: list of SKU strings.
  • Order of groups should be deterministic if tests care.

Examples

Input: group_anagram_skus(['eat', 'tea', 'tan']) Output: [['eat', 'tea'], ['tan']] This input follows the stated rules and produces this output.

Topics: lakebench, python, hash-based-problems.

More Python interview questions · All interview problems · Learn data engineering

intermediate

Anagram grouping of product SKUs

Interview-style drill: Group SKU codes that are letter-for-letter anagrams of each other.

Group product SKUs that are anagrams of one another.