Squarepoint Capital interview question

code task about dynamic programming, simple probabiltiy question