Reported November 2025
Bloomberghash table

Check Anagrams

Reported by candidates from Bloomberg's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Bloomberg OA. Under 2s to a working solution.
Founder's read

The Bloomberg OA reported in November 2025 hands you a function that returns 1 or 0, not true or false. That's the first detail to respect. Check Anagrams is a frequency-counting problem: two strings, same characters, same counts, any order. It's easy, which is exactly why a sloppy mistake costs you. The comparison is case-sensitive and the input is printable characters, not just lowercase letters. If you freeze on the edge cases during the live assessment, StealthCoder runs invisibly as a safety net and gives you a clean solution in real time.

The problem

You are given two strings s and t.
Determine whether the two strings are anagrams of each other. Two strings are anagrams if they contain exactly the same characters with the same frequencies, possibly in a different order.
Return 1 if the strings are anagrams, otherwise return 0.

Function
checkAnagrams(s: String, t: String) → int

Examples
Example 1
s = "listen"
t = "silent"
return = 1
listen and silent contain the same letters with the same frequencies.
Example 2
s = "race"
t = "care"
return = 1
race and care are anagrams.
Example 3
s = "hello"
t = "world"
return = 0
The two strings do not have matching character frequencies.

Constraints
s and t consist of printable characters.
The comparison is case-sensitive.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is counting. If the lengths differ, return 0 right away. Otherwise build a frequency map from s, then walk t and decrement each character. If any count goes below zero or a character is missing, return 0. Finish with 1. That's O(n) time. Sorting both strings and comparing also works at O(n log n), and it's fine if you can't recall the map syntax. The common pitfall is assuming 26 lowercase letters and using a fixed array of that size. The constraints say printable characters and case-sensitive, so 'A' and 'a' are different. Use a hash map or a 128-slot array. The other slip is returning a boolean when the signature wants an int. If your mind goes blank on any of this mid-OA, StealthCoder is the hedge that keeps you moving without the proctor seeing anything.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Check 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 StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as valid anagram. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Bloomberg's OA.

Bloomberg 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.

Check Anagrams FAQ

How hard is the Check Anagrams question really?+

It's an easy problem. The logic is a single pass with a frequency count. Most people who miss it do so on details: wrong return type, assuming lowercase only, or forgetting the length check. Nail those three and you're done in minutes.

What's the trick to solve it fast?+

Count characters in s, then subtract using t. If lengths differ, return 0 immediately. If any count drops below zero, return 0. Otherwise return 1. A hash map handles every printable character without extra thought.

Is the comparison case-sensitive?+

Yes. The constraints state it explicitly. So 'Listen' and 'silent' are not anagrams, because 'L' and 'l' are different characters. Don't lowercase the strings before comparing, and don't size your array for only 26 letters.

Should I sort or use a hash map?+

Either passes. Sorting both strings and comparing is shorter to write but runs in O(n log n). A hash map or fixed-size array is O(n) and shows better judgment. If you're nervous, write the sort version first, then mention the counting approach.

How do I prepare for this in 48 hours?+

Write the frequency-map solution from memory twice, once in a map and once in an array of 128. Test with equal strings, different lengths, empty strings, and mixed case. That covers what Bloomberg's version is likely checking.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Bloomberg.

OA at Bloomberg?
Invisible during screen share
Get it