FastPrepCharacter Frequencies in First-Appearance Order
Problems/Character Frequencies in First-Appearance Order

Character Frequencies in First-Appearance Order

Epic logoEpic● EasyFULLTIMENEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report describes cleaning up the text, counting letters, and listing them in the order they first appear, using a map. In this exercise, the ordered map is written as letter:count strings. Our version is about 97% the same as the reported exercise.

Count the letters in text after ignoring spaces and converting every letter to lowercase.

Return one string for each distinct letter in the order of its first appearance. Format every entry as letter:count.

Function

orderedCharacterFrequencies(text: String) → String[]

Examples

Example 1

text = "Amount Characters"return = ["a:3","m:1","o:1","u:1","n:1","t:2","c:2","h:1","r:2","e:1","s:1"]

The first distinct letters are a, m, o, u, n, t, c, h, r, e, and s.

Example 2

text = "A b A"return = ["a:2","b:1"]

Case and spaces are ignored, while a remains the first distinct letter.

Constraints

  • 1 <= text.length <= 200000
  • text contains English letters and spaces.
  • text contains at least one letter.

More Epic Online Assessment questions

  • First Completed Mingo LineOA · Seen Sep 2026
  • Minimum Adjacent TranspositionsOA · Seen Sep 2026
  • Telephone Keypad String EncodingOA · Seen Sep 2026
  • Palindrome WordOA · Seen Sep 2024

Similar questions at other companies

  • Branch with the Most FilesCapital One · OACapital One interview questions
  • 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
All Epic interview questionsSee Epic hiring insights
Saved
class Solution {
    public String[] orderedCharacterFrequencies(String text) {
        // Write your code here.
    }
}
Checking account…