Trains the technique from
LeetCode 50Pow(x, n)This is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A microscope has a motorised zoom stage. One click forward scales the magnification by factor, and one click backward undoes a forward click, so it divides the magnification by factor.
Given factor and a click count clicks, return the multiplier the stage applies overall. A positive clicks means that many clicks forward, a negative clicks means that many clicks backward, and zero clicks leave the magnification alone.
Report the multiplier rounded to 5 decimal places. The click count reaches into the billions, so a routine that turns the stage one click at a time is too slow: the number of multiplications you perform must grow with the logarithm of the click count, not with the count itself.
Example 1
Four forward clicks multiply by 3 four times over, giving 81.
Example 2
Three backward clicks divide by 2.5 three times, and 1 / 15.625 is 0.064.
Example 3
The stage never moves, so the magnification is untouched and the multiplier is 1.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def zoom_multiplier(factor: float, clicks: int) -> float:public double zoomMultiplier(double factor, int clicks)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.