Problem · String

Count Characters Before Uppercase

Learn this problem
EasyMicrosoft logoMicrosoftFULLTIMEOA
See Microsoft hiring insights

Problem statement

Given a string of letters, containing both uppercase and lowercase letters, return the number of different characters where all lowercase of that character appear before any uppercase letter.

Function

countCharactersBeforeUppercase(s: String) → int

Examples

Example 1

s = "aaAbcCABBc"return = 2

Here the output is 2, a and b, c iss not counted.

More Microsoft problems

drafts saved locally
public int countCharactersBeforeUppercase(String s) {
  // write your code here
}
s"aaAbcCABBc"
expected2
checking account