Jane Street Interview Question

Dynamic programming and expected value