Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

Valid Phone Numbers (not on codechef)

$
0
0

How many valid numbers are possible? Write a C++ program that can compute the number of unique and valid phone numbers with the following set of constraints? (a) A valid phone number is seven digits in length. Only digits are allowed. (b) A valid number doesn't begin with a zero or a one. (c) A valid number is a sequence of digits that can be traced by the movements of a knight (Like in chess) on a normal telephone keyboard. (d) Knight movement is illustrated below. Legal movements for (dot) are marked as X. For example, successors of number 8 could only be number 1 or 3.

For numpad, see http://www.blogcdn.com/www.joystiq.com/media/2007/03/225px-telephone-keypad.jpg

For knight movement, e.g. if you are at 2, possible moves are either 7 or 9.

Actually, i found this problem here, visit here for more clarity (Question No. 3) www.cs.cornell.edu/courses/cs2022/2011sp/assignments/a1.pdf‎ plz help guys.


Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>