Reported May 2020
Bloomberghash table

First Unique Letter, Case Insensitive

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

A hash map of counts is what this Bloomberg OA question from May 2020 hinges on. You get a string, you fold case, you count only English letters, and you return the first original character whose folded form shows up exactly once. Digits and symbols get ignored. Empty string if nothing qualifies. It's a first-unique-character problem with two small twists, and the twists are where people lose points. If you blank on the setup during the live assessment, StealthCoder runs invisibly as a safety net and hands you the structure in real time.

The problem

Count only English letters in text, treating uppercase and lowercase forms as the same letter. Return the first original one-character spelling whose case-folded letter occurs exactly once.
Ignore all digits and special characters. Return the empty string if no qualifying letter exists.

Function
firstUniqueLetter(text: String) → String

Examples
Example 1
text = "A1a!B?cB"
return = "c"
A/a and B/B repeat after case folding; c is unique.

Constraints
0 <= text.length <= 10^5.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Two passes. Pass one: walk the string, and for every char that's an English letter, lowercase it and increment its count in a hash map (or a 26-slot array). Pass two: walk the string again in original order, skip non-letters, and return the first original character whose lowercase count is 1. Return the original spelling, not the folded one. That's the pitfall. Example: "A1a!B?cB" returns "c", and if the answer were uppercase you'd return it uppercase. The other trap is counting digits or punctuation, or checking the fold wrong with a non-ASCII letter. Use an explicit a-z check. It's O(n) time and O(1) space with a 26 array, fine for 10^5 characters. If the live OA freezes your brain, StealthCoder is the hedge that gives you this two-pass solution on screen without the proctor seeing it.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill First Unique Letter, Case Insensitive 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. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

Bloomberg reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

First Unique Letter, Case Insensitive FAQ

What's the trick in this Bloomberg question?+

Count first, then scan again in original order. Fold case only for the counting key, never for the returned value. Skip anything that isn't an English letter in both passes. That's the whole problem, and the two-pass shape keeps it linear.

How hard is this really?+

Easy. It's a first-unique-character problem with case folding and a filter on non-letters. If you've seen the classic version, you can finish it in a few minutes. The risk is sloppy edge cases, not the algorithm.

Should I use a hash map or an array?+

Either works. A 26-element array indexed by the folded letter is faster and uses constant space. A hash map is fine too and reads cleanly. Just make sure non-letters never enter the counts.

What edge cases should I test?+

Empty string, which returns an empty string. A string of only digits and symbols. A string where every letter repeats after case folding. A unique letter that's uppercase, to confirm you return the original spelling and not the lowercase form.

How do I prepare in 48 hours?+

Write the two-pass solution from scratch twice. Then test it on the example "A1a!B?cB" and on an all-repeats input. Practice the letter check by hand so you don't lean on library methods that treat non-English letters differently.

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