FastPrepMaximum Occurring Character
Problems/Maximum Occurring Character

Maximum Occurring Character

Vanguard logoVanguard● EasyNEW GRADINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report names a problem about the character that occurs most often in ASCII text. How ties break, the limits, and how characters are handled are our assumptions. Our version is about 75% the same as the reported question.

Given a nonempty string text, return the character that occurs most often, as a string of length 1.

If several characters have the same maximum frequency, return the one with the smallest ASCII code. Comparisons are case-sensitive. Spaces and punctuation count as ordinary characters.

Function

maximumOccurringCharacter(text: String) → String

Examples

Example 1

text = "hello"return = "l"

The character l appears twice; every other character appears once.

Example 2

text = "bbaa"return = "a"

Both characters appear twice. ASCII a is smaller than b.

Constraints

  • 1 <= text.length <= 10^5.
  • Every character is printable ASCII with a code from 32 through 126.

More Vanguard Online Assessment questions

  • Two SumOA · Seen Sep 2026
  • Valid ParenthesesOA · Seen Sep 2026
  • Are They PangramsOA · Seen Nov 2025
  • Missing WordsOA · Seen Nov 2025
  • Spam DetectionOA · Seen Nov 2025
  • Binge WatchingOA · Seen Jan 2023
  • Minimum Moves Around a Circular ArrayOA · Seen Aug 2022
  • Picking TicketsOA · Seen Mar 2022
  • Tool List: Two Smallest ValuesOA · Seen Nov 2021
  • Group AnagramsOA · Seen Nov 2019

Similar questions at other companies

  • Count User Mentions in Chat MessagesRamp · OARamp interview questions
  • First Non-Repeating CharacterAmazon · OA · ONSITE INTERVIEW
  • Total Each Letter's Count in an Encoded StringIBM · OAIBM interview questions
  • Find Words That Can Be Formed by CharactersTabaPay · OA
  • Blood Type Inheritance: Possible Parent GenotypesAbridge · OAAbridge interview questions
  • Count Palindrome Addition ChoicesThe D.E. Shaw Group · OAThe D.E. Shaw Group interview questions
  • Count Palindrome Addition ChoicesHudson River Trading · OAHudson River Trading interview questions
  • Count Phrases Formed by Anagram ReplacementWells Fargo · OAWells Fargo interview questions
  • Count Repeated Request IDs (Data Science OA)McKinsey & Company · OAMcKinsey & Company interview questions
  • Branch with the Most FilesCapital One · OACapital One interview questions

Interview reports that mention this question

  • Vanguard Tech and Risk Older OAs: 12 Experiences (Part 3 of 3)
  • Vanguard Software Older Rounds: 13 Experiences (Part 2 of 3)
  • Vanguard Tech Intern Interviews: 37 Experiences (Part 1 of 3)
All Vanguard interview questionsSee Vanguard hiring insights
Saved
class Solution {
    public String maximumOccurringCharacter(String text) {
        // Write your code here.
    }
}
Checking account…