Premium problem99. Random Walk Mean and Variance

Easy Locked

A walker takes n steps, each +1+1 with probability p and −1-1 otherwise. Return (mean, variance) of the final position.

Each step has mean 2p−12p - 1 and variance 4p(1−p)4p(1-p). Steps are independent, so both quantities scale by n.

Input

n = 100
p = 0.5

Output

(0.0, 100.0)

Premium problem

This one's part of Premium. Unlock the full Probability track plus every other premium problem on the site.

Implement solve(...)