Created
July 30, 2011 01:57
-
-
Save bforrest/1115105 to your computer and use it in GitHub Desktop.
7 Digit phone number kata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| We have a regular telephone keypad and we want to know the number of "valid" 7 digit phone numbers that start from any key on the keypad, | |
| and progress to the next key using the Knight's move from chess (two squares horizontally then one vertically, | |
| or two vertically then one horizontally, making an "L" shape). | |
| "Valid" numbers may not begin with 0 or 1. | |
| Keypad: | |
| 1 2 3 | |
| 4 5 6 | |
| 7 8 9 | |
| 0 | |
| you make up the phone number by traversing. | |
| say you start with 2. | |
| you can knight move to 9 and 7. | |
| "29" begins one combo. | |
| from 9, you can move to 4 or 2. | |
| "294" is part of a combo. | |
| from 4, 3 or 9 are possible, and so on | |
| --compliments of Shayne Studdard's twisted brain. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment