Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Mobile Numeric Keypad Problem\\n
In this problem, a Numeric mobile keypad is given. We can only press top, bottom, right and left buttons of the current button, diagonal keys are not Allowed. We also cannot press the * and # buttons in the keypad.

A digit is given, we have to find the number of possible numbers of given digits can be formed, using the keypad, maintaining given rules.
Input and Output
Input: Digit count. Say 3 digit numbers. Output: Number of possible 3 digit numbers, that can be formed with the given conditions. Here the answer is 138.
Algorithm
getCount(n)
Input: number of digits n.
Output: Possible ways to type n digit numbers in a mobile keypad.
Begin if nExample
#includeusing namespace std; char keypad[4][3] = { {'1','2','3'}, {'4','5','6'}, {'7','8','9'}, {'*','0','#'} }; int getCount(int n) { if(keypad == NULL || n = 0 && rowMove =0 && colMove > n; cout Output
Number of digits: 3 Possible Combinations: 138
Advertisements
