Return Words in Repeated Anagram Groups
Company: Voleon
Role: Quantitative Researcher
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Given a list of words, return every word whose anagram signature occurs more than once in the list. A signature records how many times each letter occurs, regardless of letter order.
Implement `repeated_anagram_words(words: string[]) -> string[]`.
### Constraints & Assumptions
- At most 100000 words and at most 1000000 letters in total. Words contain lowercase ASCII letters only; empty words are allowed.
- Return qualifying occurrences in their original input order. Do not sort words or deduplicate the output.
- Identical repeated words count as multiple occurrences of their signature. Two empty words also share a repeated signature.
- A signature must preserve multiplicity: `ab` and `aab` are different.
- Aim for O(total letters + number of words) time using a fixed-size letter-count signature per word.
### Examples
```text
words = ["eat","tea","bat","eat","tan","nat","solo"]
result = ["eat","tea","eat","tan","nat"]
```
```text
words = ["a","ab","aab",""]
result = []
```
The output order and duplicate policy are explicit practice conventions where the source leaves them unspecified. Explain why a set of distinct letters is insufficient and how a count-signature avoids sorting every word.
```hint Count signatures before selecting occurrences
Whether the first word qualifies may depend on a later word. Keep the original ordering separate from the signature frequency table.
```
Overview: Return all input occurrences belonging to repeated anagram groups, preserving order and duplicates with multiplicity-aware letter-count signatures.
Read the full Voleon Quantitative Researcher interview experience this question came from
Given a list of words, return every word whose anagram signature occurs more than once in the list. A signature records how many times each letter occurs, regardless of letter order.
Implement `repeated_anagram_words(words: string[]) -> string[]`.
### Constraints & Assumptions
- At most 100000 words and at most 1000000 letters in total. Words contain lowercase ASCII letters only; empty words are allowed.
- Return qualifying occurrences in their original input order. Do not sort words or deduplicate the output.
- Identical repeated words count as multiple occurrences of their signature. Two empty words also share a repeated signature.
- A signature must preserve multiplicity: `ab` and `aab` are different.
- Aim for O(total letters + number of words) time using a fixed-size letter-count signature per word.
### Examples
```text
words = ["eat","tea","bat","eat","tan","nat","solo"]
result = ["eat","tea","eat","tan","nat"]
```
```text
words = ["a","ab","aab",""]
result = []
```
The output order and duplicate policy are explicit practice conventions where the source leaves them unspecified. Explain why a set of distinct letters is insufficient and how a count-signature avoids sorting every word.
```hint Count signatures before selecting occurrences
Whether the first word qualifies may depend on a later word. Keep the original ordering separate from the signature frequency table.
```
Constraints
- At most 100000 lowercase ASCII words and 1000000 total letters; empty words are permitted.
- A signature records the count of every letter and must preserve multiplicity.
- Return every occurrence whose signature appears more than once, in original order without deduplication.
- Identical words and repeated empty words count as repeated occurrences.
Examples
Input: (['eat', 'tea', 'bat', 'eat', 'tan', 'nat', 'solo'],)
Expected Output: ['eat', 'tea', 'eat', 'tan', 'nat']
Explanation: The source keeps every qualifying occurrence in original order.
Input: (['a', 'ab', 'aab', ''],)
Expected Output: []
Explanation: Same letter sets with different counts do not share a signature.