|
|
一家公司 给我出的面试题。。呵呵,蛮简单的。。就是好久没写了。。昨天完成了。有兴趣可以做做。。温故以前知识。
<span style="">
<span style="">Write a program that can compute the number of unique, valid phone numbers with the following constraints:
<span style="font-family: Times New Roman;">a) A valid phone number is seven digits in length
<span style="font-family: Times New Roman;">b) A valid phone number cannot begin with a zero or a one
<span style="font-family: Times New Roman;">c) A valid phone number can contain only digits
<span style="font-family: Times New Roman;">d) A valid phone number must consist of a sequence of digits that can be traced by the movements of a chess piece on a normal telephone keypad
1
| 2
| 3
| 4
| 5
| 6
| 7
| 8
| 9
| *
| 0
| <span style="font-family: Times New Roman;">#
|
|
|