Back to course home
0% completed
Vote For New Content
Solution: 2 Keys Keyboard
Problem Statement
You're given a notepad that initially displays a single character 'A'. You have two actions available to perform on this notepad for each step:
- Copy All: It allows you to
copy everythingon the screen. - Paste: You can
pastethe characters which arecopiedlast time.
Given an integer n, return the minimum number of operations to print the character 'A' exactly n times on the screen.
Examples
- Example 1:
- Input:
n = 4 - Expected Output:
4 - Justification: Start with 'A', copy it (`1
- Input:
.....
.....
.....
Like the course? Get enrolled and start learning!
On this page