x. You cannot type anything else; only two actions are available:
- **Copy**: copy the entire text on the screen to the clipboard (partial copies are not allowed);
- **Paste**: append whatever the clipboard held after the last copy.
The clipboard starts empty. Each action takes one step.
Given an integer goal, return the minimum number of actions needed to have exactly goal letters on the screen.goal=4 → 4
Copy (clipboard: 1), paste (2 letters), copy (clipboard: 2), paste (4 letters): four actions.
goal=9 → 6
Copy and paste twice to get three letters, then copy and paste twice again to get nine: six actions in total.
goal=1 → 0
The single letter is already on screen, so nothing needs to be done.
goal=4
4
Run checks the first 3 tests in your browser. Submit checks all 66 tests on the server, hidden ones included.