FastPrepFirst Unique Letter, Case Insensitive

First Unique Letter, Case Insensitive

Bloomberg LP logoBloomberg LP● EasyNEW GRADPHONE SCREEN
Learn

Problem statement

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.

More Bloomberg LP problems

See Bloomberg LP hiring insights
public String firstUniqueLetter(String text) {
  // Write your code here.
}
text"A1a!B?cB"
expected"c"
Checking account…