Words with Repeated Anagrams
Reported by candidates from The Voleon Group's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The Voleon Group reported this one in September 2026, and the detail that trips people is in the second example: ["aa","aa","b"] returns both "aa" entries. Identical strings at different indices count as anagram partners. It's a hash-table grouping problem dressed up as a trick question. You have an OA coming up, so here's the shape: bucket words by a canonical key, count each bucket, keep words whose bucket has two or more. If you blank on the details live, StealthCoder runs invisibly as a safety net while you work.
The problem
Given an array of lowercase words, return every input word whose letters can be rearranged to form at least one other word at a different input index. Preserve the original input order and occurrences. Equal strings at different indices count as anagram partners. Function wordsWithRepeatedAnagrams(words: String[]) → String[] Examples Example 1 words = ["listen","silent","cat","tac","dog"] return = ["listen","silent","cat","tac"] The first two and middle two words form repeated anagram groups. Example 2 words = ["aa","aa","b"] return = ["aa","aa"] Equal occurrences at different indices are partners. Constraints 0 <= words.length <= 100000. 1 <= words[i].length <= 100. Words contain lowercase English letters.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is a canonical key. Sort each word's letters, or build a 26-count signature, and use it as a hash map key. First pass: count how many words land on each key. Second pass: walk the original array and keep any word whose key count is at least 2. That preserves order and duplicates for free, with no extra sorting of the output. The common pitfall is deduping. Don't put words in a set, because the two "aa" entries must both come back. Another trap is treating a word as its own partner, so count occurrences by index, not by distinct string. With 100000 words of up to 100 characters, sorting each word is fine, but the count signature runs in linear time per word. Handle the empty array by returning an empty list. If the live OA makes you freeze on the two-pass structure, StealthCoder is the hedge that surfaces it.
Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.
You can drill Words with Repeated Anagrams cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass The Voleon Group's OA.
The Voleon Group reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Words with Repeated Anagrams FAQ
What's the trick in Words with Repeated Anagrams?+
Compute a canonical key per word, either the sorted letters or a 26-length count tuple. Group by key in a hash map, then return every word whose group size is at least 2. Two passes, original order preserved, nothing fancy beyond that.
Do identical words count as anagrams here?+
Yes. The statement says equal strings at different indices are partners, and example 2 proves it: ["aa","aa","b"] returns both "aa". So count by occurrences, never by unique strings. Don't use a set to dedupe the input.
How do I keep the original order?+
Build the count map in the first pass, then iterate the original array again. Append a word to the result if its key's count is 2 or more. Iterating the input directly keeps order and duplicates without any extra sorting.
Sorted key or count signature, which is better?+
Sorting each word costs O(L log L) with L up to 100, which is fine for 100000 words. A 26-count signature is O(L) and slightly faster. Either passes. Pick whichever you can write without bugs under pressure.
How hard is this really, and how do I prep in 48 hours?+
It's easy to medium. The logic is short, the risk is the duplicate rule. Write the two-pass solution once from memory, test it on both examples plus an empty array and a single word. That covers nearly every edge case.