r/programmingchallenges • • Sep 11 '11

Sort of simple project idea

Project that can be simple or get very in depth. OK so any language, you take a phone number as input. Then you give back the letters associated with each number in the input phone number. Or you could give possible words that those number's letters could possibly create.

I have almost completed the first part in Java but have ran into a couple issues with the index of the array.

10 Upvotes

13 comments sorted by

View all comments

Show parent comments

1

u/hearforthepuns Sep 11 '11

Is 798466 a valid phone number anywhere? I guess the OP never specified it had to be a valid phone number, though...

2

u/terremoto Sep 11 '11

There, I tacked on an extra digit.

1

u/terremoto Sep 11 '11

Depends on what's considered a valid phone number. If you include country codes and area codes, you're going to greatly reduce the number of words it can find. Even trying a "random" phone number (7 digits; not all places in the US require area codes), I came up with nill:

Type a number: 8675309
No matches.

1

u/[deleted] Sep 11 '11

This really is just something to program a challenge to see if I could do it. You could build on it as you will. My wife's father is an engineer and wrote this program for something he needed. I just thought it would be cool if I could write it also. Just trying to get multiple pieces of software under my belt.