Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7826209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:18:20+00:00 2026-06-02T09:18:20+00:00

I was working on a problem where I need to convert a given alpha-numeric

  • 0

I was working on a problem where I need to convert a given alpha-numeric String to text based format (don’t know what exactly to call it). Example: a = 2, c = 222, f = 333 etc. To make it more clear, this is found on your phone’s keypad. Like the way you text in the old hard key phones which didn’t have QWERTY keyboard.

Example: (INPUT) hello
(OUTPUT) 44+33+555+555+666

Here is what I had in mind. I can pre-load all the cases (26 + 10 over all) into a HashMap and use that. But I think there should be some other better way to do this right? All/any brilliant ideas are welcome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T09:18:21+00:00Added an answer on June 2, 2026 at 9:18 am

    HashMap would be the simplest way to do what you want

    Because you are working with a static set of mappings, you might want to consider implementing your lookup table as a new class. I am thinking the internals of the class can just be an array of strings. When you do a lookup in the array, you can subtract the ‘a’ char from the character you are looking up and that will become the array index. (for the punctuation characters, if the result of the subtraction is not between 0 and 25, you can handle them with special cases). This method will bypass the hash function and improve performance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a problem where I need to have a way to convert
I'm working on a problem where I need to store serialized hierarchies of Ruby
I'm working on problem 9 in Project Euler: There exists exactly one Pythagorean triplet
The problem I am working on right now requires that, given a phylogenetic tree
I'm currently working on a problem where I need to properly order (using something
I need to convert my string into int array. so i make a loop
i need to know if a specific string is contained in a list of
I'm working on problem four of Project Euler and am running into a stackoverflow
I had a problem working with the image classes in java. I am creating
I am currently working on Problem 62 I have tried the following code to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.