Minimum Moves to Reach Target

1. Understand the problem

1.1. Explain the main idea of the problem

We are given two integers:

Initially, the score is 1.

We have two possible operations:

  1. Increment: Increase the current score by 1.

    x \rightarrow x+1

  2. Double: Multiply the current score by .

    x \rightarrow 2x

The Double button can only be used at most maxDoubles times.

Our task: Find the minimum number of moves required to reach exactly target.

Important observations:

For example:

target = 19
maxDoubles = 2

One optimal sequence is: