{"id":"0b0d0d23-51ba-4722-8c8e-21b74eac2247","name":"Numeric Keypad","description":"1. You are given a number N, which represents the count of buttons pressed on a mobile numeric keypad.\r\n2. You can only press buttons that are up, left, right, down to the current button and the current button also.\r\n3. You can not press bottom row corner buttons(* and #).\r\n<img src=\"http://pepcoding.com/resources/ojquestionresource/images/nokiakeypad.jpeg\">\r\n4. You have to find the count of different numbers that can be generated by pressing N number of buttons.","inputFormat":"A number N","outputFormat":"Check the sample output and question video.","constraints":"1 &lt;= N &lt;= 30","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n\tpublic static int solution(int n) {\r\n\t\t//write your code here\r\n\r\n\t\treturn 0;\r\n\t}\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner scn = new Scanner(System.in);\r\n\t\tSystem.out.println(solution(scn.nextInt()));\r\n\t}\r\n\r\n}"},"node":{"code":""},"ruby":{"code":""},"python":{"code":""}},"points":10,"difficulty":"medium","sampleInput":"2","sampleOutput":"36\r\n","questionVideo":"https://www.youtube.com/embed/IN3uTs8afz4?end=732","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"5539a6e8-c8bf-4f04-805c-e43e9d20e72a","name":"Dynamic Programming For Intermediate","slug":"dynamic-programming-for-intermediate-408","type":0},{"id":"98fe3019-fbd1-4c9e-86e9-152deae4164c","name":"Numeric Keypad","slug":"numeric-keypad","type":1}],"next":{"id":"bb96309a-bfc4-4589-bb40-631ae0f48b4b","name":"NUMERIC KEYPAD MCQ","type":0,"slug":"numeric-keypad-mcq"},"prev":{"id":"1095bcb8-71a1-4731-baeb-b47ee65e1cd6","name":"Min Squares","type":3,"slug":"min-squares"}}}

Numeric Keypad

1. You are given a number N, which represents the count of buttons pressed on a mobile numeric keypad. 2. You can only press buttons that are up, left, right, down to the current button and the current button also. 3. You can not press bottom row corner buttons(* and #). <img src="http://pepcoding.com/resources/ojquestionresource/images/nokiakeypad.jpeg"> 4. You have to find the count of different numbers that can be generated by pressing N number of buttons.

{"id":"0b0d0d23-51ba-4722-8c8e-21b74eac2247","name":"Numeric Keypad","description":"1. You are given a number N, which represents the count of buttons pressed on a mobile numeric keypad.\r\n2. You can only press buttons that are up, left, right, down to the current button and the current button also.\r\n3. You can not press bottom row corner buttons(* and #).\r\n<img src=\"http://pepcoding.com/resources/ojquestionresource/images/nokiakeypad.jpeg\">\r\n4. You have to find the count of different numbers that can be generated by pressing N number of buttons.","inputFormat":"A number N","outputFormat":"Check the sample output and question video.","constraints":"1 &lt;= N &lt;= 30","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n\tpublic static int solution(int n) {\r\n\t\t//write your code here\r\n\r\n\t\treturn 0;\r\n\t}\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner scn = new Scanner(System.in);\r\n\t\tSystem.out.println(solution(scn.nextInt()));\r\n\t}\r\n\r\n}"},"node":{"code":""},"ruby":{"code":""},"python":{"code":""}},"points":10,"difficulty":"medium","sampleInput":"2","sampleOutput":"36\r\n","questionVideo":"https://www.youtube.com/embed/IN3uTs8afz4?end=732","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"5539a6e8-c8bf-4f04-805c-e43e9d20e72a","name":"Dynamic Programming For Intermediate","slug":"dynamic-programming-for-intermediate-408","type":0},{"id":"98fe3019-fbd1-4c9e-86e9-152deae4164c","name":"Numeric Keypad","slug":"numeric-keypad","type":1}],"next":{"id":"bb96309a-bfc4-4589-bb40-631ae0f48b4b","name":"NUMERIC KEYPAD MCQ","type":0,"slug":"numeric-keypad-mcq"},"prev":{"id":"1095bcb8-71a1-4731-baeb-b47ee65e1cd6","name":"Min Squares","type":3,"slug":"min-squares"}}}
plane

Editor


Loading...

Numeric Keypad

medium

1. You are given a number N, which represents the count of buttons pressed on a mobile numeric keypad. 2. You can only press buttons that are up, left, right, down to the current button and the current button also. 3. You can not press bottom row corner buttons(* and #). 4. You have to find the count of different numbers that can be generated by pressing N number of buttons.

Constraints

1 <= N <= 30

Format

Input

A number N

Output

Check the sample output and question video.

Example

Sample Input

2

Sample Output

36

Question Video

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode