Frog jump expected time

Write codeHard30 minCitadel style

Your task

A frog starts on stair 0 and wants to reach stair n. From any stair i < n it jumps to i+1 with probability p and stays on i with probability (1-p) (a wasted jump), each jump taking one unit of time. Return the expected number of jumps (time units) to first reach stair n, rounded to 6 decimal places. Constraints: 1 <= n <= 100000, 0.0 < p <= 1.0.

Examples

expected_jumps(n: int, p: float) -> float
Example 1
Inputexpected_jumps(1, 1)
Output1