Search⌘ K
AI Features

2 Keys Keyboard

Try to solve the 2 Keys Keyboard problem.

We'll cover the following...

Statement

You start with a text editor that initially contains a single character 'A'. You can perform only the following operations.

Copy All: copy the entire current content to the clipboard.
Paste: append the clipboard content to the current content.

Given an integer n, return the minimum number of operations needed to end with exactly n characters 'A' in the editor.

Constraints: ...