FastPrepRemove Later Anagrams From a List
Problems/Remove Later Anagrams From a List

Remove Later Anagrams From a List

Bloomberg LP logoBloomberg LP● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: An experienced engineer's report on a first virtual round at Bloomberg describes this task in one line: go through a list of words and, when several are anagrams of each other, keep only the earliest. It gives no example and no limits.

Everything else here is our practice choice. Two words are anagrams when they use the same letters the same number of times, so a repeated word counts too and is dropped. A later anagram is dropped wherever it appears, not only right after its match. Kept words stay in their original order. A list has 1 to 5,000 words of 1 to 20 lowercase English letters.

The judged task matches the report at about 85%.

You are given an array of strings words. Go through the words from first to last. Keep a word only if no word kept before it is an anagram of it. Otherwise remove it.

Two words are anagrams when they use exactly the same letters, each the same number of times. For example, "stone" and "notes" are anagrams, but "aab" and "abb" are not. A word is an anagram of itself, so a repeated word is removed too.

A later anagram is removed wherever it appears, not only right after its match. Return the kept words in their original order.

Function

removeLaterAnagrams(words: String[]) → List<String>

Examples

Example 1

words = ["listen","stone","silent","notes","enlist","tones","apple"]return = ["listen","stone","apple"]

Go through the words in order.

  • "listen" is new, so keep it.
  • "stone" is new, so keep it.
  • "silent" has the same letters as "listen", which was kept earlier. Remove it.
  • "notes" and "tones" have the same letters as "stone". Remove both.
  • "enlist" has the same letters as "listen". Remove it.
  • "apple" is new, so keep it.

The kept words, in their original order, are "listen", "stone" and "apple".

Example 2

words = ["aab","abb","bab","aba"]return = ["aab","abb"]

"aab" has two a's and one b, but "abb" has one a and two b's. They use the same letters different numbers of times, so they are not anagrams, and both are kept. "bab" is an anagram of "abb" and "aba" is an anagram of "aab", so both are removed.

Example 3

words = ["loop","pool","polo","loop"]return = ["loop"]

All four words use one l, two o's and one p. Only the first one, "loop", is kept. The last word is the same word again, and a word is an anagram of itself, so it is removed too.

Constraints

  • 1 <= words.length <= 5000
  • 1 <= words[i].length <= 20
  • words[i] contains only lowercase English letters.

More Bloomberg LP Phone Screen questions

  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
  • Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
  • Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Sparse Vector and Matrix OperationsPHONE SCREEN · Seen Oct 2026
  • Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Shared Courses for Every Pair of StudentsCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Convert an Entry List to a MapEPAM · PHONE SCREENEPAM interview questions
  • Employees With Shared InterestsPalantir · PHONE SCREENPalantir interview questions
  • Group AnagramsWorkday · PHONE SCREEN
  • Process Shopping Records, Promotions, and Display OrderInstacart · PHONE SCREEN · ONSITE INTERVIEWInstacart interview questions
  • Find Duplicate File GroupsAnthropic · PHONE SCREENAnthropic interview questions
  • Insert an Employee into an Organization HierarchyWaymo · PHONE SCREENWaymo interview questions
  • Group AnagramsMotive · PHONE SCREEN · ONSITE INTERVIEWMotive interview questions
  • Stable Top K Frequent WordsGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Find Duplicate Image FilesAbnormal Security · PHONE SCREEN

Bloomberg LP interview experiences

  • Bloomberg SWE Phone Screen and Onsite: 1 Experience
  • Bloomberg SWE Phone Screens with Two Teams: 1 Experience
  • Bloomberg AI Interview, Hiring Level Not Reported: 2 Experiences
  • Bloomberg Experienced SWE AI Coding Interviews: 2 Experiences
  • Bloomberg New Grad AI-Assisted Coding Rounds: 3 Experiences
  • Bloomberg New Grad SWE AI-Assisted Coding Rounds: 1 Experience
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public List<String> removeLaterAnagrams(String[] words) {
        // Write your code here.
    }
}
Checking account…