LeetCode solutions

1303. Minimum Moves to Reach Target Score

My accepted Python solution to LeetCode problem 1303, Minimum Moves to Reach Target Score, running in 0ms.

  • Difficulty: Medium
  • Python
  • Runtime 0ms
  • Memory 17.6MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 0ms, memory 17.6MB, accepted 2025-12-29.

python
class Solution:
    def minMoves(self, target: int, maxDoubles: int) -> int:
        moves = 0
        while target > 1:
            if target % 2 == 0 and maxDoubles > 0:
                target //= 2
                maxDoubles -= 1
            elif maxDoubles == 0:
                moves += target - 1
                break
            else:
                target -= 1
            moves += 1
        return moves

Source