Your car starts at position target, return the minimum number of instructions needed for the car to reach that position.
The car accepts two instructions:
A accelerates the car. Its position increases by its current speed, then its speed doubles.
R reverses the car. Its position remains unchanged, and its speed becomes
Implement def racecar(self, target): to return the length of the shortest instruction sequence that moves the car to target.
Constraints:
target
Your car starts at position target, return the minimum number of instructions needed for the car to reach that position.
The car accepts two instructions:
A accelerates the car. Its position increases by its current speed, then its speed doubles.
R reverses the car. Its position remains unchanged, and its speed becomes
Implement def racecar(self, target): to return the length of the shortest instruction sequence that moves the car to target.
Constraints:
target