FastPrepTelephone Keypad String Encoding
Problems/Telephone Keypad String Encoding

Telephone Keypad String Encoding

Epic logoEpic● EasyFULLTIMENEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report gives the full keypad mapping, the cleanup rules, the separator rule, an example, and the shape of the function. We only added limits on the input. Our version is about 99% the same as the reported exercise.

Encode text using a traditional telephone keypad. Letters on keys 2 through 9 require one through four presses according to their position on the key.

  • Ignore spaces and treat uppercase and lowercase letters identically.
  • If two consecutive encoded letters use the same key, insert # between their digit sequences.

Return the complete encoded string.

Function

encodeKeypad(text: String) → String

Examples

Example 1

text = "AB"return = "2#22"

A and B share key 2, so a separator is inserted.

Example 2

text = "HEY EPIC"return = "4433999337444222"

The space is ignored and no adjacent encoded letters share a keypad key.

Constraints

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

More Epic Online Assessment questions

  • Character Frequencies in First-Appearance OrderOA · Seen Sep 2026
  • First Completed Mingo LineOA · Seen Sep 2026
  • Minimum Adjacent TranspositionsOA · Seen Sep 2026
  • Palindrome WordOA · Seen Sep 2024

Similar questions at other companies

  • Branch with the Most FilesCapital One · OACapital One interview questions
  • Robot Stops Left or Right (Forward Deployed Engineer)Boston Consulting Group · OABoston Consulting Group interview questions
  • Blood Type Inheritance: Possible Parent GenotypesAbridge · OAAbridge interview questions
  • REST API: Highest International StudentsRippling · OARippling interview questions
  • Rearrange String by Alternating EndsHudson River Trading · OAHudson River Trading interview questions
  • Filter Isolated Interior Signal BitsSEDEMAC · OA
  • Scale Ingredient QuantitiesUpstart · OAUpstart interview questions
  • Count Invalid Log GroupsIBM · OAIBM interview questions
  • Count Case-Insensitive TripletsTikTok · OATikTok interview questions
  • Simulate a Deterministic Finite AutomatonPoint72 · OAPoint72 interview questions
All Epic interview questionsSee Epic hiring insights
Saved
class Solution {
    public String encodeKeypad(String text) {
        // Write your code here.
    }
}
Checking account…