All problems
Random Walk Return After Even Steps
Problem
A simple symmetric random walk returns to the origin after 2k steps with probability C(2k, k) / 4^k.
Given k, return the return probability.
Hint
Half the steps must be up, half down.
Test cases
case 1
in: [1]
expected: 0.5
case 2
in: [2]
expected: 0.375
case 3
in: [5]
expected: 0.24609375
Starter codePython
def random_walk_return_after_even_steps(k):
# Your code here
pass3 test cases · run your code against them in the editor