Squarepoint Capital Interview Question

code task about dynamic programming, simple probabiltiy question