{"id":"10c153c7-a3c8-479f-bcdd-5f17b3800d58","name":"4 Key Keyboard","description":"1. Imagine you have a special keyboard with the following keys - \r\n Key 1 : Print 'X' on the screen.\r\n key 2 : Select screen.\r\n Key 3 : Copy selection to buffer.\r\n Key 4 : Print buffer on screen appending to what has already been printed.\r\n2. You are given a number N, which represents the number of times the keyboard is pressed.\r\n3. You have to find the maximum number of 'X' that can be produced by pressing the N number of keys. ","inputFormat":"A number N","outputFormat":"Check the sample output and question video.","constraints":"1 <= N <= 100","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\t\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner scn = new Scanner(System.in);\r\n\t\tint n = scn.nextInt();\r\n\t\tSystem.out.println(solution(n));\r\n\t}\r\n\r\n}"},"node":{"code":""},"ruby":{"code":""},"python":{"code":""}},"points":10,"difficulty":"hard","sampleInput":"3","sampleOutput":"3\r\n","questionVideo":"","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":"b3ee4f4e-3f27-451e-b230-8621d997f3cc","name":"4 Key Keyboard","slug":"4-key-keyboard","type":1}],"next":{"id":"686ba90f-0d2a-461e-9ea1-2b5b4321a1cb","name":"Largest Square Sub-matrix With All 1's","type":1,"slug":"largest-square-sub-matrix-with-all-1-s"},"prev":{"id":"8d8ab01b-f102-4543-973a-69f3c57119ce","name":"2 Key Keyboard","type":1,"slug":"2-key-keyboard"}}}

4 Key Keyboard

1. Imagine you have a special keyboard with the following keys - Key 1 : Print 'X' on the screen. key 2 : Select screen. Key 3 : Copy selection to buffer. Key 4 : Print buffer on screen appending to what has already been printed. 2. You are given a number N, which represents the number of times the keyboard is pressed. 3. You have to find the maximum number of 'X' that can be produced by pressing the N number of keys.

{"id":"10c153c7-a3c8-479f-bcdd-5f17b3800d58","name":"4 Key Keyboard","description":"1. Imagine you have a special keyboard with the following keys - \r\n Key 1 : Print 'X' on the screen.\r\n key 2 : Select screen.\r\n Key 3 : Copy selection to buffer.\r\n Key 4 : Print buffer on screen appending to what has already been printed.\r\n2. You are given a number N, which represents the number of times the keyboard is pressed.\r\n3. You have to find the maximum number of 'X' that can be produced by pressing the N number of keys. ","inputFormat":"A number N","outputFormat":"Check the sample output and question video.","constraints":"1 <= N <= 100","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\t\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner scn = new Scanner(System.in);\r\n\t\tint n = scn.nextInt();\r\n\t\tSystem.out.println(solution(n));\r\n\t}\r\n\r\n}"},"node":{"code":""},"ruby":{"code":""},"python":{"code":""}},"points":10,"difficulty":"hard","sampleInput":"3","sampleOutput":"3\r\n","questionVideo":"","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":"b3ee4f4e-3f27-451e-b230-8621d997f3cc","name":"4 Key Keyboard","slug":"4-key-keyboard","type":1}],"next":{"id":"686ba90f-0d2a-461e-9ea1-2b5b4321a1cb","name":"Largest Square Sub-matrix With All 1's","type":1,"slug":"largest-square-sub-matrix-with-all-1-s"},"prev":{"id":"8d8ab01b-f102-4543-973a-69f3c57119ce","name":"2 Key Keyboard","type":1,"slug":"2-key-keyboard"}}}
plane

Editor


Loading...

4 Key Keyboard

hard

1. Imagine you have a special keyboard with the following keys - Key 1 : Print 'X' on the screen. key 2 : Select screen. Key 3 : Copy selection to buffer. Key 4 : Print buffer on screen appending to what has already been printed. 2. You are given a number N, which represents the number of times the keyboard is pressed. 3. You have to find the maximum number of 'X' that can be produced by pressing the N number of keys.

Constraints

1 <= N <= 100

Format

Input

A number N

Output

Check the sample output and question video.

Example

Sample Input

3

Sample Output

3

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode