Skip to content

Practice Minimum Moves to Reach Target Score

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#2139
LeetCode Problem

Minimum Moves to Reach Target Score

Problem Statement

Start at 1. One move either increases the current integer by 1 or doubles it. Increases are unlimited, but at most maxDoubles moves may double the value. Return the minimum moves needed to reach target.

Source: Minimum Moves to Reach Target Score on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
target = 5, maxDoubles = 0
Output
4

# Example 2

Input
target = 19, maxDoubles = 2
Output
7

# Example 3

Input
target = 10, maxDoubles = 4
Output
4

Constraints

1 <= target <= 10^9
0 <= maxDoubles <= 100

Related LeetCode Problems

Practice more problems similar to Minimum Moves to Reach Target Score.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.