moves to 0 to count the number of moves.target is greater than 1:
a. If maxDoubles is greater than 0 and target is even, halve the target and decrement maxDoubles.
b. If maxDoubles is 0 or target is odd, decrement the target.
c. Increment moves after each operation.moves.